[08/30] usb: gadget/atmel_usba_udc: Use devm_platform_get_and_ioremap_resource()

Message ID 20230726113816.888-8-frank.li@vivo.com
State New
Headers
Series [01/30] usb: ehci-npcm7xx: fix typo in npcm7xx_ehci_hcd_drv_probe() |

Commit Message

李扬韬 July 26, 2023, 11:37 a.m. UTC
  Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Comments

claudiu beznea July 27, 2023, 5:34 a.m. UTC | #1
On 26.07.2023 14:37, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>

> ---
>   drivers/usb/gadget/udc/atmel_usba_udc.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 6c0ed3fa5eb1..02b1bef5e22e 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -2285,15 +2285,13 @@ static int usba_udc_probe(struct platform_device *pdev)
>   	udc->gadget = usba_gadget_template;
>   	INIT_LIST_HEAD(&udc->gadget.ep_list);
>   
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
> -	udc->regs = devm_ioremap_resource(&pdev->dev, res);
> +	udc->regs = devm_platform_get_and_ioremap_resource(pdev, CTRL_IOMEM_ID, &res);
>   	if (IS_ERR(udc->regs))
>   		return PTR_ERR(udc->regs);
>   	dev_info(&pdev->dev, "MMIO registers at %pR mapped at %p\n",
>   		 res, udc->regs);
>   
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
> -	udc->fifo = devm_ioremap_resource(&pdev->dev, res);
> +	udc->fifo = devm_platform_get_and_ioremap_resource(pdev, FIFO_IOMEM_ID, &res);
>   	if (IS_ERR(udc->fifo))
>   		return PTR_ERR(udc->fifo);
>   	dev_info(&pdev->dev, "FIFO at %pR mapped at %p\n", res, udc->fifo);
  
cristian.birsan@microchip.com July 27, 2023, 12:20 p.m. UTC | #2
On 7/27/23 08:34, claudiu beznea wrote:
> 
> On 26.07.2023 14:37, Yangtao Li wrote:
>> Convert platform_get_resource(), devm_ioremap_resource() to a single
>> call to devm_platform_get_and_ioremap_resource(), as this is exactly
>> what this function does.
>>
>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> 
> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>

Acked-by: Cristian Birsan <cristian.birsan@microchip.com>

> 
>> ---
>>   drivers/usb/gadget/udc/atmel_usba_udc.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> index 6c0ed3fa5eb1..02b1bef5e22e 100644
>> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
>> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
>> @@ -2285,15 +2285,13 @@ static int usba_udc_probe(struct platform_device *pdev)
>>       udc->gadget = usba_gadget_template;
>>       INIT_LIST_HEAD(&udc->gadget.ep_list);
>>
>> -     res = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
>> -     udc->regs = devm_ioremap_resource(&pdev->dev, res);
>> +     udc->regs = devm_platform_get_and_ioremap_resource(pdev, CTRL_IOMEM_ID, &res);
>>       if (IS_ERR(udc->regs))
>>               return PTR_ERR(udc->regs);
>>       dev_info(&pdev->dev, "MMIO registers at %pR mapped at %p\n",
>>                res, udc->regs);
>>
>> -     res = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
>> -     udc->fifo = devm_ioremap_resource(&pdev->dev, res);
>> +     udc->fifo = devm_platform_get_and_ioremap_resource(pdev, FIFO_IOMEM_ID, &res);
>>       if (IS_ERR(udc->fifo))
>>               return PTR_ERR(udc->fifo);
>>       dev_info(&pdev->dev, "FIFO at %pR mapped at %p\n", res, udc->fifo);
  

Patch

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 6c0ed3fa5eb1..02b1bef5e22e 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2285,15 +2285,13 @@  static int usba_udc_probe(struct platform_device *pdev)
 	udc->gadget = usba_gadget_template;
 	INIT_LIST_HEAD(&udc->gadget.ep_list);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
-	udc->regs = devm_ioremap_resource(&pdev->dev, res);
+	udc->regs = devm_platform_get_and_ioremap_resource(pdev, CTRL_IOMEM_ID, &res);
 	if (IS_ERR(udc->regs))
 		return PTR_ERR(udc->regs);
 	dev_info(&pdev->dev, "MMIO registers at %pR mapped at %p\n",
 		 res, udc->regs);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
-	udc->fifo = devm_ioremap_resource(&pdev->dev, res);
+	udc->fifo = devm_platform_get_and_ioremap_resource(pdev, FIFO_IOMEM_ID, &res);
 	if (IS_ERR(udc->fifo))
 		return PTR_ERR(udc->fifo);
 	dev_info(&pdev->dev, "FIFO at %pR mapped at %p\n", res, udc->fifo);