From: "Alvin Šipraga" <ALSI@bang-olufsen.dk>
To: "Linus Walleij" <linus.walleij@linaro.org>,
"Alvin Šipraga" <alvin@pqrs.dk>
Cc: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Michael Rasmussen <MIR@bang-olufsen.dk>,
netdev <netdev@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC
Date: Thu, 14 Oct 2021 12:11:16 +0000 [thread overview]
Message-ID: <ea99a19b-3d3e-4a11-01d5-d49f95be36a0@bang-olufsen.dk> (raw)
In-Reply-To: <CACRpkdYwTUopZ_6khRpkAPFg6qiRTOgyKe=URzVRrNagK2HZMw@mail.gmail.com>
On 10/13/21 5:12 PM, Linus Walleij wrote:
> On Tue, Oct 12, 2021 at 2:37 PM Alvin Šipraga <alvin@pqrs.dk> wrote:
>
>> This patch adds a realtek-smi subdriver for the RTL8365MB-VC 4+1 port
>> 10/100/1000M switch controller. The driver has been developed based on a
>> GPL-licensed OS-agnostic Realtek vendor driver known as rtl8367c found
>> in the OpenWrt source tree.
> (...)
>> Co-developed-by: Michael Rasmussen <mir@bang-olufsen.dk>
>> Signed-off-by: Michael Rasmussen <mir@bang-olufsen.dk>
>> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
>
> Overall this driver looks very good :)
>
> Some minor nits below:
>
>> +static irqreturn_t rtl8365mb_irq(int irq, void *data)
>> +{
> (...)
>> + if (!line_changes)
>> + goto out_none;
>> +
>> + while (line_changes) {
>> + int line = __ffs(line_changes);
>> + int child_irq;
>> +
>> + line_changes &= ~BIT(line);
>> +
>> + child_irq = irq_find_mapping(smi->irqdomain, line);
>> + handle_nested_irq(child_irq);
>> + }
>
> What about just:
>
> for_each_set_bit(offset, &line_changes, 32) {
> child_irq = irq_find_mapping(smi->irqdomain, line);
> handle_nested_irq(child_irq);
> }
>
> ?
>
> I don't know how many or which bits are valid IRQs, 16 maybe rather
> than 32.
>
>> +static struct irq_chip rtl8365mb_irq_chip = {
>> + .name = "rtl8365mb",
>> + /* The hardware doesn't support masking IRQs on a per-port basis */
>> +};
>
> I would rathe make this a dynamically allocated struct inside
> struct rtl8365mb, so the irqchip lives with the instance of the
> chip. (Which is nice if there would happen to be two of these
> chips in a system.)
Forgive my ignorance, but is it actually necessary? Can't multiple
instances of the switch still use the same irq_chip structure? That
seems to be OK for the dummy chip, for example (dummychip.c). I also
failed to find a driver which does it the way you suggest.
I will incorporate the rest of your feedback into v3. :)
>
>> +static int _rtl8365mb_irq_enable(struct realtek_smi *smi, bool enable)
>
> I'm personally a bit allergic to _rand_underscore_naming, as sometimes
> that means "inner function" and sometimes it means "compiler intrinsic"
> I would just name it rtl8365mb_irq_config_commit()
>
> (no strong opinion)
>
>> + /* Configure chip interrupt signal polarity */
>> + irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
>
> Nice that you preserve this edge trigger config from the machine
> description (DT)!
>
> With this fixed or not (your preference)
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Yours,
> Linus Walleij
>
next prev parent reply other threads:[~2021-10-14 12:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 12:35 [PATCH net-next 0/6] net: dsa: add support for RTL8365MB-VC Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 1/6] ether: add EtherType for proprietary Realtek protocols Alvin Šipraga
2021-10-12 13:09 ` Vladimir Oltean
2021-10-12 12:35 ` [PATCH net-next 2/6] net: dsa: move NET_DSA_TAG_RTL4_A to right place in Kconfig/Makefile Alvin Šipraga
2021-10-12 12:42 ` Vladimir Oltean
2021-10-13 10:50 ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 3/6] dt-bindings: net: dsa: realtek-smi: document new compatible rtl8365mb Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 4/6] net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag Alvin Šipraga
2021-10-12 12:50 ` Vladimir Oltean
2021-10-12 12:56 ` Alvin Šipraga
2021-10-13 9:45 ` DENG Qingfang
2021-10-13 9:52 ` Alvin Šipraga
2021-10-13 11:02 ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC Alvin Šipraga
2021-10-12 13:04 ` Vladimir Oltean
2021-10-12 13:22 ` Alvin Šipraga
2021-10-12 13:50 ` Alvin Šipraga
2021-10-12 14:03 ` Vladimir Oltean
2021-10-12 14:30 ` Alvin Šipraga
2021-10-12 15:27 ` Jakub Kicinski
2021-10-13 8:33 ` Alvin Šipraga
2021-10-13 15:13 ` Jakub Kicinski
2021-10-14 12:44 ` Alvin Šipraga
2021-10-14 14:08 ` Jakub Kicinski
2021-10-13 9:55 ` DENG Qingfang
2021-10-13 10:05 ` Alvin Šipraga
2021-10-13 10:10 ` Vladimir Oltean
2021-10-13 10:13 ` DENG Qingfang
2021-10-13 15:12 ` Linus Walleij
2021-10-14 12:11 ` Alvin Šipraga [this message]
2021-10-12 12:35 ` [PATCH net-next 6/6] net: phy: realtek: add support for RTL8365MB-VC internal PHYs Alvin Šipraga
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=ea99a19b-3d3e-4a11-01d5-d49f95be36a0@bang-olufsen.dk \
--to=alsi@bang-olufsen.dk \
--cc=MIR@bang-olufsen.dk \
--cc=alvin@pqrs.dk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=robh+dt@kernel.org \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).