[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240816-coccinelle-followup-v3-3-79fbc2742fa8@chromium.org>
Date: Fri, 16 Aug 2024 12:30:31 +0000
From: Ricardo Ribalda <ribalda@...omium.org>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Ricardo Ribalda <ribalda@...omium.org>
Subject: [PATCH v3 3/3] media: drivers/media/dvb-core: CodoStyle for
dvb_frontend_open()
We can rearrange a bit the function to reduce the indentation levels.
No functional change added to this patch.
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
drivers/media/dvb-core/dvb_frontend.c | 49 ++++++++++++++++-------------------
1 file changed, 22 insertions(+), 27 deletions(-)
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index 16d21ec6ff35..f714fc432dea 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2875,7 +2875,6 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
struct dvb_device *dvbdev = file->private_data;
struct dvb_frontend *fe = dvbdev->priv;
struct dvb_adapter *adapter = fe->dvb;
- int ret;
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (fe->exit == DVB_FE_DEVICE_REMOVED)
@@ -2893,36 +2892,32 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
return -EBUSY;
adapter->mfe_dvbdev = dvbdev;
}
- } else {
- if (!adapter->mfe_dvbdev) {
+ return __dvb_frontend_open(inode, file);
+ }
+
+ if (!adapter->mfe_dvbdev) {
+ adapter->mfe_dvbdev = dvbdev;
+ } else if (adapter->mfe_dvbdev != dvbdev) {
+ struct dvb_device *mfedev = adapter->mfe_dvbdev;
+ struct dvb_frontend *mfe = mfedev->priv;
+ struct dvb_frontend_private *mfepriv = mfe->frontend_priv;
+ int ret;
+
+ ret = wait_dvb_frontend(adapter, mfedev);
+ if (ret)
+ return ret;
+
+ if (adapter->mfe_dvbdev != dvbdev) {
+ mfedev = adapter->mfe_dvbdev;
+ mfe = mfedev->priv;
+ mfepriv = mfe->frontend_priv;
+ if (mfedev->users != -1 || mfepriv->thread)
+ return -EBUSY;
adapter->mfe_dvbdev = dvbdev;
- } else if (adapter->mfe_dvbdev != dvbdev) {
- struct dvb_device
- *mfedev = adapter->mfe_dvbdev;
- struct dvb_frontend
- *mfe = mfedev->priv;
- struct dvb_frontend_private
- *mfepriv = mfe->frontend_priv;
-
- ret = wait_dvb_frontend(adapter, mfedev);
- if (ret)
- return ret;
-
- if (adapter->mfe_dvbdev != dvbdev) {
- mfedev = adapter->mfe_dvbdev;
- mfe = mfedev->priv;
- mfepriv = mfe->frontend_priv;
- if (mfedev->users != -1 ||
- mfepriv->thread)
- return -EBUSY;
- adapter->mfe_dvbdev = dvbdev;
- }
}
}
- ret = __dvb_frontend_open(inode, file);
-
- return ret;
+ return __dvb_frontend_open(inode, file);
}
static int dvb_frontend_release(struct inode *inode, struct file *file)
--
2.46.0.184.g6999bdac58-goog
Powered by blists - more mailing lists