Thread (39 messages) 39 messages, 12 authors, 2024-12-26

Re: [PATCH v3 1/7] mfd: Add core driver for Nuvoton NCT6694

From: Linus Walleij <hidden>
Date: 2024-12-20 12:45:52
Also in: linux-can, linux-gpio, linux-hwmon, linux-i2c, linux-rtc, linux-watchdog, lkml

Hi Ming,

thanks for your patch!

On Tue, Dec 10, 2024 at 11:45 AM Ming Yu [off-list ref] wrote:
The Nuvoton NCT6694 is a peripheral expander with 16 GPIO chips,
6 I2C controllers, 2 CANfd controllers, 2 Watchdog timers, ADC,
PWM, and RTC.

This driver implements USB device functionality and shares the
chip's peripherals as a child device.

Each child device can use the USB functions nct6694_read_msg()
and nct6694_write_msg() to issue a command. They can also request
interrupt that will be called when the USB device receives its
interrupt pipe.

Signed-off-by: Ming Yu <tmyu0@nuvoton.com>
(...)
+       while (*int_status) {
+               int irq = __ffs(*int_status);
+
+               if (*int_status & (1 << irq))
+                       generic_handle_irq_safe(irq_find_mapping(nct6694->domain, irq));
+
+               *int_status &= ~(1 << irq);
What about doing what you do in the GPIO driver and
#include <linux/bits.h>

And search and replace "(1 << irq)" with BIT(irq)?

PS the main reason we do this is because

int a = (1 << 31);

becomes a negative number on 32bit machines, and
can lead to confusing side effects. BIT() always work
on unsigned.

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