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

Ming Yu
2025-06-05T07:50:07Z

Dear Guenter,

Thank you for reviewing,

Guenter Roeck <linux@roeck-us.net> 於 2025年6月4日 週三 下午8:40寫道：
>
> >> +static void usb_int_callback(struct urb *urb)
> >> +{
> >> + struct nct6694 *nct6694 = urb->context;
> >> + unsigned int *int_status = urb->transfer_buffer;
> >> + int ret;
> >> +
> >> + switch (urb->status) {
> >> + case 0:
> >> + break;
> >> + case -ECONNRESET:
> >> + case -ENOENT:
> >> + case -ESHUTDOWN:
> >> + return;
> >> + default:
> >> + goto resubmit;
> >> + }
> >> +
> >> + while (*int_status) {
> >> + int irq = __ffs(*int_status);
> >> +
> >> + generic_handle_irq_safe(irq_find_mapping(nct6694->domain, irq));
> >> + *int_status &= ~BIT(irq);
> >> + }
> >
> > Does modifying the byte have any benefit?
> >
>
> Not sure if I understand the question, and assuming your question is regarding
> *int_status: *int_status!=0 is the loop invariant, so, yes, modifying it does
> have a benefit.
>
> I'd be more concerned that transfer_buffer is the raw buffer, and that data
> read from it is not endianness converted. That makes me wonder if and how the
> code would work on a big endian system.
>

I will update the code in the next patch to use __le32 for the
variable to ensure proper endianness handling across architectures.

Best regards,
Ming