[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<FR3P281MB1757324BA65151253A82F8C8CE922@FR3P281MB1757.DEUP281.PROD.OUTLOOK.COM>
Date: Mon, 2 Sep 2024 10:04:12 +0000
From: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@....com>
To: gyeyoung <gye976@...il.com>, Markus Elfring <Markus.Elfring@....de>
CC: "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
Jonathan Cameron
<jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
LKML
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: imu: inv_mpu6050: Remove duplicate code between
labels
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@...il.com>
Sent: Sunday, September 1, 2024 15:40
To: Markus Elfring <Markus.Elfring@....de>
Cc: linux-iio@...r.kernel.org <linux-iio@...r.kernel.org>; Jonathan Cameron <jic23@...nel.org>; Lars-Peter Clausen <lars@...afoo.de>; LKML <linux-kernel@...r.kernel.org>
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@....de> 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
Powered by blists - more mailing lists