[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdZh4hCvBN=7beFEgm-mmdwSTW1fd8OZhQO3kr6Cy7P=dA@mail.gmail.com>
Date: Fri, 20 Dec 2024 13:45:39 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Ming Yu <a0282524688@...il.com>
Cc: tmyu0@...oton.com, lee@...nel.org, brgl@...ev.pl, andi.shyti@...nel.org,
mkl@...gutronix.de, mailhol.vincent@...adoo.fr, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
wim@...ux-watchdog.org, linux@...ck-us.net, jdelvare@...e.com,
alexandre.belloni@...tlin.com, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-rtc@...r.kernel.org
Subject: Re: [PATCH v3 1/7] mfd: Add core driver for Nuvoton NCT6694
Hi Ming,
thanks for your patch!
On Tue, Dec 10, 2024 at 11:45 AM Ming Yu <a0282524688@...il.com> 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@...oton.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
Powered by blists - more mailing lists