Re: [PATCH] iio: imu: inv_mpu6050: Remove duplicate code between labels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

it would be true if there was a return statement before the 2 labels, and that the 2 lables were only error handling case.

But this is not the case, since end_session label is the end of the normal end of the function, not error handling. This is very old code and not very clear, I'm sorry about that.

But the modifications are breaking the code and interrupt handling will not work correctly anymore, since inv_reset_fifo() will be called now every time the function is called.

Best regards,
JB

________________________________________
From: gyeyoung <gye976@xxxxxxxxx>
Sent: Sunday, September 1, 2024 15:40
To: Markus Elfring <Markus.Elfring@xxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx <linux-iio@xxxxxxxxxxxxxxx>; Jonathan Cameron <jic23@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>; LKML <linux-kernel@xxxxxxxxxxxxxxx>
Subject: Re: [PATCH] iio: imu: inv_mpu6050: Remove duplicate code between labels
 
This Message Is From an Untrusted Sender
You have not previously corresponded with this sender.
 
Hello, I apologize for the insufficient explanation.

---
Before the change:

"end_session:
    mutex_unlock(&st->lock);
    iio_trigger_notify_done(indio_dev->trig);
    return IRQ_HANDLED;

flush_fifo:
    /* Flush HW and SW FIFOs. */
    inv_reset_fifo(indio_dev);
    mutex_unlock(&st->lock);
    iio_trigger_notify_done(indio_dev->trig);
    return IRQ_HANDLED;
"
---
After the change:

"flush_fifo:
/* Flush HW and SW FIFOs. */
inv_reset_fifo(indio_dev);

end_session:
mutex_unlock(&st->lock);
iio_trigger_notify_done(indio_dev->trig);

return IRQ_HANDLED;"
---

Here, 'flush_fifo' and 'end_session' are not the same. However, the
work of 'flush_fifo' is a superset of 'end_session'.


On Sun, Sep 1, 2024 at 9:08 PM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> > 'flush_fifo' label performs same task as 'endsession' label
>
>                                             end_session?
>
> The number of actions differ between involved jump targets.
>
>
> > immediately after calling 'env_reset_fifo' function.
> > so i remove that duplication.
>
> * You would like to specify a corresponding goto chain at the moment,
>   don't you?
>   https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.11-rc5*n526__;Iw!!FtrhtPsWDhZ6tw!EFMuPFwY7oiEXqGmGjNGpAH4EZl_mGVb10vu2XoO2X4fNR50y46xuljrl3hOjULZkOE_d6FlNqFz3XCZY9d-1V0$[git[.]kernel[.]org]
>
> * How do you think about to increase the application of scope-based resource management?

firstly I understood that you might be referring to RAII. but I think
this issue is not related to RAII.
thanks for response.

>
>
> Regards,
> Markus





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux