Thread (32 messages) 32 messages, 7 authors, 2021-10-14

Re: [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC

From: Linus Walleij <hidden>
Date: 2021-10-13 15:13:04
Also in: linux-devicetree, lkml

On Tue, Oct 12, 2021 at 2:37 PM Alvin Šipraga [off-list ref] 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 <redacted>
Signed-off-by: Michael Rasmussen <redacted>
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.)
+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 <redacted>

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help