diff mbox series

[net-next,1/2] net: natsemi: xtsonic: switch to use platform_get_irq()

Message ID 20221025031236.1031330-1-yangyingliang@huawei.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/2] net: natsemi: xtsonic: switch to use platform_get_irq() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: rdunlap@infradead.org jcmvbkbc@gmail.com edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yang Yingliang Oct. 25, 2022, 3:12 a.m. UTC
Switch to use platform_get_irq() which supports more cases.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/natsemi/xtsonic.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Jakub Kicinski Oct. 25, 2022, 4:11 a.m. UTC | #1
On Tue, 25 Oct 2022 11:12:35 +0800 Yang Yingliang wrote:
> Switch to use platform_get_irq() which supports more cases.

More cases of what? You need to explain what you're trying to achieve
and why you're touching this old driver.

> diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
> index 52fef34d43f9..ffb3814c54cb 100644
> --- a/drivers/net/ethernet/natsemi/xtsonic.c
> +++ b/drivers/net/ethernet/natsemi/xtsonic.c
> @@ -201,14 +201,17 @@ int xtsonic_probe(struct platform_device *pdev)
>  {
>  	struct net_device *dev;
>  	struct sonic_local *lp;
> -	struct resource *resmem, *resirq;
> +	struct resource *resmem;
> +	int irq;
>  	int err = 0;

The variable declaration lines should be sorted longest to shortest.

>  	if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL)
>  		return -ENODEV;
>  
> -	if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL)
> -		return -ENODEV;
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
> +
>  

extra new line
Yang Yingliang Oct. 25, 2022, 8:32 a.m. UTC | #2
On 2022/10/25 12:11, Jakub Kicinski wrote:
> On Tue, 25 Oct 2022 11:12:35 +0800 Yang Yingliang wrote:
>> Switch to use platform_get_irq() which supports more cases.
> More cases of what? You need to explain what you're trying to achieve
> and why you're touching this old driver.
platform_get_irq() is a common API which calls of_irq_get(), 
platform_get_resource() or
acpi_dev_gpio_irq_get() to get irq, and it returns exactly error code.

Thanks,
Yang
>
>> diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
>> index 52fef34d43f9..ffb3814c54cb 100644
>> --- a/drivers/net/ethernet/natsemi/xtsonic.c
>> +++ b/drivers/net/ethernet/natsemi/xtsonic.c
>> @@ -201,14 +201,17 @@ int xtsonic_probe(struct platform_device *pdev)
>>   {
>>   	struct net_device *dev;
>>   	struct sonic_local *lp;
>> -	struct resource *resmem, *resirq;
>> +	struct resource *resmem;
>> +	int irq;
>>   	int err = 0;
> The variable declaration lines should be sorted longest to shortest.
>
>>   	if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL)
>>   		return -ENODEV;
>>   
>> -	if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL)
>> -		return -ENODEV;
>> +	irq = platform_get_irq(pdev, 0);
>> +	if (irq < 0)
>> +		return irq;
>> +
>>   
> extra new line
> .
diff mbox series

Patch

diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
index 52fef34d43f9..ffb3814c54cb 100644
--- a/drivers/net/ethernet/natsemi/xtsonic.c
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -201,14 +201,17 @@  int xtsonic_probe(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct sonic_local *lp;
-	struct resource *resmem, *resirq;
+	struct resource *resmem;
+	int irq;
 	int err = 0;
 
 	if ((resmem = platform_get_resource(pdev, IORESOURCE_MEM, 0)) == NULL)
 		return -ENODEV;
 
-	if ((resirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0)) == NULL)
-		return -ENODEV;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 
 	if ((dev = alloc_etherdev(sizeof(struct sonic_local))) == NULL)
 		return -ENOMEM;
@@ -219,7 +222,7 @@  int xtsonic_probe(struct platform_device *pdev)
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	dev->base_addr = resmem->start;
-	dev->irq = resirq->start;
+	dev->irq = irq;
 
 	if ((err = sonic_probe1(dev)))
 		goto out;