Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp349802lqg; Thu, 11 Apr 2024 05:13:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFkUZDyWCv6rd51iUe1mctgfrOxJh2zT9SRLdZiwrkxaGla48L/g3mHtK0vlaxYOr7hoafXwskVmTRoKmlFaijvBFHbey5mlpZhJta8A== X-Google-Smtp-Source: AGHT+IFBbzjvCoTO/6kROuw0zyzxmrT7l7tqsmRbbZfVOlUPI1OBvjOKTifCvW1y/BNVMfHq6L1T X-Received: by 2002:a05:6358:6a91:b0:183:c2e1:9b4a with SMTP id n17-20020a0563586a9100b00183c2e19b4amr5867633rwh.18.1712837596990; Thu, 11 Apr 2024 05:13:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712837596; cv=pass; d=google.com; s=arc-20160816; b=FvfQE2gZkpVK8chrPZby4hWTc4eQl2FnUf51O1I+FejB6pYX9Jsg50oosq9P+qDoqM jxpMz/5MOpHJkS8CNLWAyO0LV17XNR8z7XKtP97/pf/wHvLiX5QZMVjXlrqKWzOMdjjK 8aDKInAJ6LTs3eSfmj/leHJQ4WH69RxvTPTWQSxcM/MP1igQMvVdrjitNEkceKZOIYN4 GER/0JD5EuDDD0rAidzL0+sTM56ynQH1rZwlGb1r4sszkX56ZmsulN714lsM1ln8MTgm 0AB9F24eXtsLmO9KRAXNEQ0alDEWxCMk7Mj/Lz7CtXRGwFgU67rRBWVn7pcWa3b6lK/j J8yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=qDIUcsRKzDDRzeuhZx5cMagTLLTJx/wTwjnhBA/vtbg=; fh=crX78oV+pf/e86UKSl9ej1a+xIniC/JM02K9lo9xHu0=; b=VH/Rw0ynO4akadcowrGJqn19AF3Bc2WLkyfdOgV4KdZoMF/iFp7CLbXCYWTlkRxxF2 fQWhXETUfeI88k7Gzj1akT+UJcbWIe60qimlzCgicYSPwmWFpbEcMMk1+BiZmTM+nvCw Y21gFGrJ5jPEP1Uk0omi2JjgMY6clJN4wFEtuMCiKYIJ4nBjMOdW0LaaGAx8n0BdsznP 1ipDHMV6Tw6D+qzfX66rvrGodgMrAyGwb8GnSjOT1puEKz5hd/JMc6erkRlpWX/88J+h CPDx0/iPAvT/H8cdKPjp2AEWHCloDwic9PyQKuLuRKa+VToulEUcLQa78bQo2mpF1zG/ YttQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AxdAMtPA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-140396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 35-20020a631263000000b005cecc6097f2si1157720pgs.895.2024.04.11.05.13.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 05:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AxdAMtPA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-140396-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140396-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B8CEB24A6F for ; Thu, 11 Apr 2024 12:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55D9F14AD3D; Thu, 11 Apr 2024 12:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AxdAMtPA" Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C2D114AD26; Thu, 11 Apr 2024 12:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712836979; cv=none; b=KegLV6LWNXMW8W8ugL8Z5I9V8lUgNnZXUeKTRPxYEP6jON12YQAtPYfm8GGWXXAym3vYA1fTJ3QaPdr5NZ1KmnP1PRI5ON6s+E4C45UHBenvBN92RmZDTZPLt7gDu7da2EvhhRYKhUtmd192g4fgvHV/HiBzDyhMoppl8rE570k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712836979; c=relaxed/simple; bh=NUChQD7L1PzpSkBKFayAUtvIDZjjyv5AjRgErLbm498=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Content-Type; b=aSpgaMb6tdIf0gsEXDpr3YaXvbi6omNmmNgqNp65jOlEuFpHCUyeGfKUFfD+Dg5ccvkM5F81i6ZGlu3itDYk20zgYq6cFJ8OjyunzeaYGqEL7JMAUnhD+qjMPJ1CGEL7qrW7ziN8l0S2bVKjYU85ZJmre/b+dbuJ+DyJki7UTdc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AxdAMtPA; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2a53b331400so2707351a91.1; Thu, 11 Apr 2024 05:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712836977; x=1713441777; darn=vger.kernel.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qDIUcsRKzDDRzeuhZx5cMagTLLTJx/wTwjnhBA/vtbg=; b=AxdAMtPAlbvfIYgGa8NN1TOwL7/TkjGN5vyinLoCNWPE+jmdK0e2P6B9QJKaA9wHkf z54YblURDbkXj2FZTKRhBYn1jM8tj+M3SY92Q1ZkoXhJxINv8MRrvF1Pp9UsQIS26Lbh jjpxCzAoeeQj6rznrk1LrGnb0+9FYooflTmzfXu4phKyDPkNr/z5F+KLbAFtdAFPVvuR poS7Ym+9/KV53SjxPMdGb20otXokyC/FXfisA5Odx4i121KZLDMJn/wkd1e/rwp8Za5o ruDtLYYlyMwdGX86UAWRhJt6M/xG15/UMUwaiMSXuQ052bGwLa9kgg0FVnxlrVZo+880 H1Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712836977; x=1713441777; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qDIUcsRKzDDRzeuhZx5cMagTLLTJx/wTwjnhBA/vtbg=; b=sS32BczSumJkLSRlP9SHYKdj1Hs0zGEz1FLj9EKzLZCL/T/TL2Ym8soKwLB0ZPwusN mGBaRnf03gYUU2FBs/jzy8/u7tB+feUUULeeBcF7hm3deerXGrfU8NhCJGNbPQhUDkmo Daq3isODE+7OqCbdYuKm28NaNazuz75x2Oq6BrBS/CePuYQPYr/P6NYOl2n9wHc7R6dd gVm5UlqvXEJy+ePyVPUJkjhvIT867Gz9wKT2Aoz8W8LseJn/TDEVTzJdI+I6QEgM07Eq MAo6fnpr4eaWDjPTO7jPQMOsVQihGUM6SVMTyXKCA4PffHvTFVRzXv3z6+YiKSNV6/xT P0gQ== X-Forwarded-Encrypted: i=1; AJvYcCUfYES73XG/AT4jvvF+k2yae2gV2OITam0P4iAEebuS1Mxy6UOLnMMP/7umselqSGQhx3bL1zlEP5cGSqH5ejjsZ7M1oaJRGkw+gioBYT5nyscCe94VzRZtjKdL3PVEtYtkCF8o9AgqVJw= X-Gm-Message-State: AOJu0YygcF1d40QQ8TcCS9hh9eT5wgFt3RzIWUBGuSLCUYtsuIo87b7o RKZb4bxja3lpoldFovXYmbQyzyPpBuSVJxhlDtLS1e/ajDase9Z1d7uKU24M3YEMjMQC5tYMvrF 1uxr4JnxSBjEe9MnHPwm+JyyROOKw5A== X-Received: by 2002:a17:90b:4f83:b0:2a2:7693:399e with SMTP id qe3-20020a17090b4f8300b002a27693399emr5050228pjb.4.1712836977114; Thu, 11 Apr 2024 05:02:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240308121338.1983-1-yongsuyoo0215@gmail.com> In-Reply-To: <20240308121338.1983-1-yongsuyoo0215@gmail.com> From: YongSu Yoo Date: Thu, 11 Apr 2024 21:02:45 +0900 Message-ID: Subject: Re: [PATCH] media: dvb_ca_en50221: Add a returing EBUSY logic into CA_RESET To: mchehab@kernel.org, yongsuyoo0215@gmail.com, v4bel@theori.io, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear All Can you review this patch ? Can you share how this modification is going ? 2024=EB=85=84 3=EC=9B=94 8=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 9:13, =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > From: Yongsu yoo > > Signed-off-by:Yongsu Yoo > > In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET ioctl > is called, in a normal case, the state of the thread of the > dvb_ca_en50221_thread_state_machine will transit like below order. > DVB_CA_SLOTSTATE_NONE -> DVB_CA_SLOTSTATE_UNINITIALISED -> > DVB_CA_SLOTSTATE_WAITREADY -> DVB_CA_SLOTSTATE_VALIDATE -> > DVB_CA_SLOTSTATE_WAITFR -> DVB_CA_SLOTSTATE_LINKINIT -> > DVB_CA_SLOTSTATE_RUNNING > But in some problem cases, the state will become DVB_CA_SLOTSTATE_INVALID= . > Among the above mentioned states, the DVB_CA_SLOTSTATE_NONE and > the DVB_CA_SLOTSTATE_INVALID are "already stablized" states, > whereas other states are "transiting" states. > The "already stablized" states mean no matter how long time we wait, > the state will not be changed. > The "transiting" states mean the states whose final state is not yet > determined. The state keeps to be changed. Only after some time passes, > we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNING > or DVB_CA_SLOTSTATE_INVALID. > During the "transiting" states, we do not yet know whether the > CA_RESET operation, which triggered the "transiting" states, will > succeed or fail. For this reason, during the "transiting" states, if > another CA_RESET ioctl is called and if this new CA_RESET ioctl > operation begins again, it will be meaningless and waste time. > For preventing this problem from happening, we make CA_RESET ioctl do > nothing and only return EBUSY if the ioctl is called during the > "transiting" states. > --- > drivers/media/dvb-core/dvb_ca_en50221.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-= core/dvb_ca_en50221.c > index baf64540dc00..2e8aec354b7c 100644 > --- a/drivers/media/dvb-core/dvb_ca_en50221.c > +++ b/drivers/media/dvb-core/dvb_ca_en50221.c > @@ -1362,13 +1362,19 @@ static int dvb_ca_en50221_io_do_ioctl(struct file= *file, > struct dvb_ca_slot *sl =3D &ca->slot_info[slot]; > > mutex_lock(&sl->slot_lock); > - if (sl->slot_state !=3D DVB_CA_SLOTSTATE_NONE) { > + if ((sl->slot_state =3D=3D DVB_CA_SLOTSTATE_RUNNI= NG) || > + (sl->slot_state =3D=3D DVB_CA_SLOTSTATE_INVAL= ID)) { > dvb_ca_en50221_slot_shutdown(ca, slot); > if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_C= AMCHANGE) > dvb_ca_en50221_camchange_irq(ca->= pub, > slot= , > DVB_= CA_EN50221_CAMCHANGE_INSERTED); > } > + else { > + if (sl->slot_state !=3D DVB_CA_SLOTSTATE_= NONE) { > + err =3D -EBUSY; > + } > + } > mutex_unlock(&sl->slot_lock); > } > ca->next_read_slot =3D 0; > -- > 2.17.1 >