Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: yongsuyoo0215@gmail.com
To: mchehab@kernel.org, yongsuyoo0215@gmail.com, v4bel@theori.io,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: dvb_ca_en50221: Fix a bug for detecting CI MODULE
Date: Fri,  8 Mar 2024 12:10:21 +0000	[thread overview]
Message-ID: <20240308121021.1732-1-yongsuyoo0215@gmail.com> (raw)

From: Yongsu yoo <yongsuyoo0215@gmail.com>

Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com>

In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET
ioctl is called, the dvb_ca_en50221_slot_shutdown will also be called.
Inside of the dvb_ca_en50221_slot_shutdown,
the ca->slot_info[slot].slot_state will become DVB_CA_SLOTSTATE_NONE.
In the most of cases, the ca->slot_info[slot].slot_state will quickly
becomes restored to other states by the subsequent operations of the
thread dvb_ca_en50221_thread_state_machine.
But in some rare cases, when the CA_GET_SLOT_INFO ioctl is immediately
called after the CA_RESET ioctl is called, the
the ca->slot_info[slot].slot_state can still remains at
DVB_CA_SLOTSTATE_NONE, and this causes CA_GET_SLOT_INFO ioctl not to
return CA_CI_MODULE_PRESENT as info->flags even if CA_CI_MODULE is
really connected on TV. This means that the CA_GET_SLOT_INFO ioctl
does not return right informtion. This is a Bug. We fix this bug.
---
 drivers/media/dvb-core/dvb_ca_en50221.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index baf64540dc00..8d37c3c13227 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1403,6 +1403,10 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file,
 		    (sl->slot_state != DVB_CA_SLOTSTATE_INVALID)) {
 			info->flags = CA_CI_MODULE_PRESENT;
 		}
+		if ((sl->slot_state == DVB_CA_SLOTSTATE_NONE) &&
+		    (sl->camchange_type == DVB_CA_EN50221_CAMCHANGE_INSERTED)) {
+			info->flags = CA_CI_MODULE_PRESENT;
+	     	}
 		if (sl->slot_state == DVB_CA_SLOTSTATE_RUNNING)
 			info->flags |= CA_CI_MODULE_READY;
 		break;
-- 
2.17.1


             reply	other threads:[~2024-03-08 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 12:10 yongsuyoo0215 [this message]
2024-04-11 12:03 ` [PATCH] media: dvb_ca_en50221: Fix a bug for detecting CI MODULE YongSu Yoo
2024-05-01  7:54   ` YongSu Yoo
2024-05-01 16:25 ` Markus Elfring
2024-05-23 13:11   ` YongSu Yoo
2024-05-23 14:02     ` Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308121021.1732-1-yongsuyoo0215@gmail.com \
    --to=yongsuyoo0215@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=v4bel@theori.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).