All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: bt1-pvt: Convert to devm_platform_ioremap_resource()
@ 2023-07-04  9:43 Yangtao Li
  2023-07-15 17:01 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2023-07-04  9:43 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck; +Cc: Yangtao Li, linux-hwmon, linux-kernel

Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/hwmon/bt1-pvt.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c
index 8d402a627306..b77ebac2e0ce 100644
--- a/drivers/hwmon/bt1-pvt.c
+++ b/drivers/hwmon/bt1-pvt.c
@@ -891,15 +891,8 @@ static struct pvt_hwmon *pvt_create_data(struct platform_device *pdev)
 static int pvt_request_regs(struct pvt_hwmon *pvt)
 {
 	struct platform_device *pdev = to_platform_device(pvt->dev);
-	struct resource *res;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(pvt->dev, "Couldn't find PVT memresource\n");
-		return -EINVAL;
-	}
-
-	pvt->regs = devm_ioremap_resource(pvt->dev, res);
+	pvt->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pvt->regs))
 		return PTR_ERR(pvt->regs);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: bt1-pvt: Convert to devm_platform_ioremap_resource()
  2023-07-04  9:43 [PATCH] hwmon: bt1-pvt: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-15 17:01 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2023-07-15 17:01 UTC (permalink / raw)
  To: Yangtao Li; +Cc: Jean Delvare, linux-hwmon, linux-kernel

On Tue, Jul 04, 2023 at 05:43:06PM +0800, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/bt1-pvt.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c
> index 8d402a627306..b77ebac2e0ce 100644
> --- a/drivers/hwmon/bt1-pvt.c
> +++ b/drivers/hwmon/bt1-pvt.c
> @@ -891,15 +891,8 @@ static struct pvt_hwmon *pvt_create_data(struct platform_device *pdev)
>  static int pvt_request_regs(struct pvt_hwmon *pvt)
>  {
>  	struct platform_device *pdev = to_platform_device(pvt->dev);
> -	struct resource *res;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res) {
> -		dev_err(pvt->dev, "Couldn't find PVT memresource\n");
> -		return -EINVAL;
> -	}
> -
> -	pvt->regs = devm_ioremap_resource(pvt->dev, res);
> +	pvt->regs = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(pvt->regs))
>  		return PTR_ERR(pvt->regs);
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-15 17:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04  9:43 [PATCH] hwmon: bt1-pvt: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-15 17:01 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.