From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: claudiu beznea <claudiu.beznea@tuxon.dev>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-renesas-soc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH net-next 1/5] net: ravb: Get rid of the temporary variable irq
Date: Fri, 9 Feb 2024 22:43:15 +0300 [thread overview]
Message-ID: <38ed2c42-4077-7ee2-5cd0-9d38e217c944@omp.ru> (raw)
In-Reply-To: <13956279-3ab1-4eb8-b361-a0c79135cb56@tuxon.dev>
On 2/9/24 8:48 AM, claudiu beznea wrote:
[...]
>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>>
>>> The 4th argument of ravb_setup_irq() is used to save the IRQ number that
>>> will be further used by the driver code. Not all ravb_setup_irqs() calls
>>> need to save the IRQ number. The previous code used to pass a dummy
>>> variable as the 4th argument in case the IRQ is not needed for further
>>> usage. That is not necessary as the code from ravb_setup_irq() can detect
>>> by itself if the IRQ needs to be saved. Thus, get rid of the code that is
>>> not needed.
>>>
>>> Reported-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>> [...]
>>
>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>>> index 9521cd054274..e235342e0827 100644
>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>>> @@ -2611,17 +2611,20 @@ static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name,
>>> if (!dev_name)
>>> return -ENOMEM;
>>>
>>> - *irq = platform_get_irq_byname(pdev, irq_name);
>>> + error = platform_get_irq_byname(pdev, irq_name);
>>> flags = 0;
>>> } else {
>>> dev_name = ndev->name;
>>> - *irq = platform_get_irq(pdev, 0);
>>> + error = platform_get_irq(pdev, 0);
>>> flags = IRQF_SHARED;
>>> }
>>> - if (*irq < 0)
>>> - return *irq;
>>> + if (error < 0)
>>> + return error;
>>>
>>> - error = devm_request_irq(dev, *irq, handler, flags, dev_name, ndev);
>>> + if (irq)
>>> + *irq = error;
>>> +
>>> + error = devm_request_irq(dev, error, handler, flags, dev_name, ndev);
>>> if (error)
>>> netdev_err(ndev, "cannot request IRQ %s\n", dev_name);
>>>
>>
>> Thanks for addressing my IRC comment! Tho the naming seems awful. :-)
if (error < 0)
return error;
if (irq)
*irq = error;
error = devm_request_irq(dev, error, handler, flags, dev_name, ndev);
These just don't look right...
>> I'd suggest to add a local variable (named e.g, irq_num) and use it to
>
> I tried to avoid that...
Why? :-)
>> store the result of platform_get_irq[_byname]().
>>
>> [...]
MBR, Sergey
next prev parent reply other threads:[~2024-02-09 19:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 12:07 [PATCH net-next 0/5] net: ravb: Add runtime PM support (part 2) Claudiu
2024-02-07 12:07 ` [PATCH net-next 1/5] net: ravb: Get rid of the temporary variable irq Claudiu
2024-02-08 20:43 ` Sergey Shtylyov
2024-02-09 5:48 ` claudiu beznea
2024-02-09 19:43 ` Sergey Shtylyov [this message]
2024-02-08 20:44 ` Sergey Shtylyov
2024-02-07 12:07 ` [PATCH net-next 2/5] net: ravb: Keep the reverse order of operations in ravb_close() Claudiu
2024-02-07 12:07 ` [PATCH net-next 3/5] net: ravb: Return cached statistics if the interface is down Claudiu
2024-02-07 20:18 ` Sergey Shtylyov
2024-02-07 12:07 ` [PATCH net-next 4/5] net: ravb: Do not apply RX checksum settings to hardware " Claudiu
2024-02-07 20:50 ` Sergey Shtylyov
2024-02-08 8:09 ` Biju Das
2024-02-08 9:16 ` Biju Das
2024-02-08 16:11 ` claudiu beznea
2024-02-07 12:07 ` [PATCH net-next 5/5] net: ravb: Add runtime PM support Claudiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38ed2c42-4077-7ee2-5cd0-9d38e217c944@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®