2019-04-01 05:30:12

by Anson Huang

[permalink] [raw]
Subject: [PATCH] rtc: snvs: use devm_platform_ioremap_resource() to simplify code

Use the new helper devm_platform_ioremap_resource() which wraps the
platform_get_resource() and devm_ioremap_resource() together, to
simplify the code.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/rtc/rtc-snvs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index ce73eab..e0edd594 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -272,7 +272,6 @@ static const struct regmap_config snvs_rtc_config = {
static int snvs_rtc_probe(struct platform_device *pdev)
{
struct snvs_rtc_data *data;
- struct resource *res;
int ret;
void __iomem *mmio;

@@ -284,9 +283,8 @@ static int snvs_rtc_probe(struct platform_device *pdev)

if (IS_ERR(data->regmap)) {
dev_warn(&pdev->dev, "snvs rtc: you use old dts file, please update it\n");
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

- mmio = devm_ioremap_resource(&pdev->dev, res);
+ mmio = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mmio))
return PTR_ERR(mmio);

--
2.7.4


2019-04-01 07:59:43

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] rtc: snvs: use devm_platform_ioremap_resource() to simplify code


On 4/1/2019 10:59 AM, Anson Huang wrote:
> Use the new helper devm_platform_ioremap_resource() which wraps the
> platform_get_resource() and devm_ioremap_resource() together, to
> simplify the code.
>
> Signed-off-by: Anson Huang <[email protected]>
> ---
> drivers/rtc/rtc-snvs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
> index ce73eab..e0edd594 100644
> --- a/drivers/rtc/rtc-snvs.c
> +++ b/drivers/rtc/rtc-snvs.c
> @@ -272,7 +272,6 @@ static const struct regmap_config snvs_rtc_config = {
> static int snvs_rtc_probe(struct platform_device *pdev)
> {
> struct snvs_rtc_data *data;
> - struct resource *res;
> int ret;
> void __iomem *mmio;
>
> @@ -284,9 +283,8 @@ static int snvs_rtc_probe(struct platform_device *pdev)
>
> if (IS_ERR(data->regmap)) {
> dev_warn(&pdev->dev, "snvs rtc: you use old dts file, please update it\n");
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
Remove this blank line.

Reviewed-by: Mukesh Ojha <[email protected]>

Cheers,
-Mukesh

> - mmio = devm_ioremap_resource(&pdev->dev, res);
> + mmio = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(mmio))
> return PTR_ERR(mmio);
>

2019-04-01 13:13:51

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] rtc: snvs: use devm_platform_ioremap_resource() to simplify code

On 01/04/2019 05:29:13+0000, Anson Huang wrote:
> Use the new helper devm_platform_ioremap_resource() which wraps the
> platform_get_resource() and devm_ioremap_resource() together, to
> simplify the code.
>
> Signed-off-by: Anson Huang <[email protected]>
> ---
> drivers/rtc/rtc-snvs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com