Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp994312lqp; Thu, 23 May 2024 06:22:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDkitG6KObUP5Hn00Gqkm8CQcxEGNaclORqStr6ajzUqczR9ExzPK+tl2ogDqfoFYAJY9GpTQhoJQrkZO135Y8TmSHO+j1NBH/JGk2QA== X-Google-Smtp-Source: AGHT+IHoAnxoZY2CmDD2i7HmFwXYyfWejaJsIJjzIUhurU02BYfgrSY8PDq6oIieJ8GVrUUYMP9X X-Received: by 2002:a05:6512:143:b0:516:d18b:eae8 with SMTP id 2adb3069b0e04-526be316a91mr2935249e87.41.1716470566610; Thu, 23 May 2024 06:22:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716470566; cv=pass; d=google.com; s=arc-20160816; b=rbEoQygMZPhKBhPKuu34uGe7My+T70cSmXbl0DvoPK6EEkpkvwu367WZNnqrfmpszE O56djRMTZ9u5wZrrZ4CrIJjkE8/dZ/7KM7UBYWgA3+yCH5NregZIDKd4kY7+Gn9XsXrV 47Vczk+9Rf+kK520mBZsUHjWkw3/YVfjQmcTJmfLFsgIhLnuzCvvnUGREAfQwr5CSogN vV9hq/JMV/WKN0IjOk9DZbb0bGSBBsRmJucAZbmOx+QqEn5kF0uXcq/Gz3crWg4Xdoa/ yBZo7ZgyhQ03B1ER5Wyp/wg4VWNDrnSoEdbNDpUrNoSs3e1ipg3azk+8c6Are/tgMgBo PMDQ== 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=krAgymTN13Qe0M2nWYZtjIVSErtkmVKszicusS4cC9A=; fh=H3zH6HD8ec7A/qSHMIHU/I26tuhQtb6b0PfVjonx1OI=; b=j1Q9ojQsdgOJbrY5DuKL2uvrXkUkgKjgzDsRR6zaneoVIPe9CwDQztvOcIvd0ajNMG rJM9w9TEv1AuN7H3DEmXhDYTP71jrdAZToJDC/kW+3e30dAf9ux0jC3WsAQzZpTwhfPv s0skw+eiowMhg5vvezteJZjsuen97Zk5ZCJrmfOfbHkDQM/wix+O+XcDE3q9fOPilIyc qkmnJIOzLkUgKE3Z++K7yitYsTFC0USDa3UbJZcAS7mlBrb8Bxjj8jiTmAchHML56V4u axAR6DR1ckN7TOSjvEEuH+91qhF11FLLZWovMu0g8meNsHBG3WoYxmKBS030c2HQDH1e OuDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G1NdlwvX; 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-187556-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-574f7cbe7bbsi9872266a12.668.2024.05.23.06.22.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 06:22:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187556-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G1NdlwvX; 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-187556-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187556-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9D2581F24471 for ; Thu, 23 May 2024 13:16:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2946514A4F4; Thu, 23 May 2024 13:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G1NdlwvX" Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 BE9A41D52D; Thu, 23 May 2024 13:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470188; cv=none; b=XR6F82KXcpcCecV8wQO4Qy5m7I+1LFu43UUFJYPp9Fiz2SGBNRf/dqkTw+QrmulI3ShuECzuGTBxVjHR1xrEzZWoZZhI5gJJcXD7GHfGTOj+kH0ezAXU4azW6c3OTBuWdNLySuGfBwZkR7QIQ3BKrtChp5cV7w6lR7JNBOgxozA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470188; c=relaxed/simple; bh=HfO10miRj/En55ix6RsWM7ErWsVGO7O8xMQcsVwjejI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Content-Type; b=e5pQcAen4mZmsWAjc7la3w3HSgI5HRTE1PF61HwkZMljV4PeCy2K9n5mNVBQDHr3FkWcyWnxCEHUnmUSbaGrkM4MSG6JV5qxCt2Q1xs1cHbHUJorZy0oXYMuQwNELqFgdMcrC/zP4zORvecr5XXilpLz23GVRZxUkRe7hOKSsXM= 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=G1NdlwvX; arc=none smtp.client-ip=209.85.216.51 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-f51.google.com with SMTP id 98e67ed59e1d1-2bd8e2fba43so2043314a91.1; Thu, 23 May 2024 06:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716470186; x=1717074986; 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=krAgymTN13Qe0M2nWYZtjIVSErtkmVKszicusS4cC9A=; b=G1NdlwvXjtM9o7OkyCXbg4/EYmyczH2B7kUKdRuHDPq0obhE8AmVPtreFJlKNsfmhw NoBj/rSCcDPX+2QDAAnJ0P+xmMFMClRVIEfl8yfuGFjoVrVRBSRZPkgnp9922JcM1QFN YnKmR62OqPMK0Wn9+MuuLVQOwRD6BtPhB3NiJO0Asd8KL2OCjnV8hjd+wBZi0Rp6QEAo rK+SK5C+QX+V91uugNTujEEpyOgi9p5SZqMiUE71MYSaPlvWi/aDNh4+nzH6+Wavx/s9 H1yLutvEgJVUdyelz+qO5nHiMzOAgsXpu/uG+LFJvDQC661bpMUygWgmkiIa9vVtQfiq Fwlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716470186; x=1717074986; 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=krAgymTN13Qe0M2nWYZtjIVSErtkmVKszicusS4cC9A=; b=Zk9aWeufOZ/bPs0jerZX9nHBoSWuniEXklWd1sLp3nSgEE8/FBUFCTnb0NLJT+I3Ev XHeKDJxcB3MKVxqeoEnG4sOUMvkMy13E+fgVDCLd1TmfxAwdrh8koTK/tyZ5BqmeLelN WXfbjP8z+uGZma/1OwqVqcWoc0aw5UOZPx6vm/4m49p0AGumRBUR225NtWIEVjU6y0KD BS74pNJWSaDubJPC/hyhaLFNychAzeCN1CtAwTBZbkfsfNksnt0sTPHnIgA7n8BcpF9t XDTLuZmR0CwxAmtF3sNjLh3fJ0w//HSK4D+ejSbxGllY2oNDBjXLstcSl/+wm/Erz0S4 9YUQ== X-Forwarded-Encrypted: i=1; AJvYcCUpI8HJA9oSAbk5BXwWLwN/AkEfqb6fcyn+ORtac0ElXRIwp/DSxKzBliA3dx2eBuj5m2VI+s97mwqYLyF7exxUzAaTYPLAPppsOon1UI9we0OPcm+giAxoemiMbczCg+przMZZOam/uf0= X-Gm-Message-State: AOJu0YwE2sQiCXQVxI+302uedoQkvOSnWMh5+xvUregbuX8wv1imqbVA DTXSKoqC/5H5w1n3+UmiYhuvc+sggOwQ1M03bsFT8eXhHN4Vt9ix51+omUjOIKWs1RqpVt0ohgJ ycSPKQAujnu83N0E95oCSeQAO9Bg= X-Received: by 2002:a17:90b:1916:b0:2be:c0:f088 with SMTP id 98e67ed59e1d1-2be00c0f107mr286624a91.38.1716470186007; Thu, 23 May 2024 06:16:26 -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: From: YongSu Yoo Date: Thu, 23 May 2024 22:16:15 +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 5=EC=9B=94 1=EC=9D=BC (=EC=88=98) =EC=98=A4=ED=9B=84 4:54, Yo= ngSu Yoo =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > Dear All > > Can you review this patch ? > Can you share how this modification is going ? > > 2024=EB=85=84 4=EC=9B=94 11=EC=9D=BC (=EB=AA=A9) =EC=98=A4=ED=9B=84 9:02,= YongSu Yoo =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > > > 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 io= ctl > > > 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_INV= ALID. > > > 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 passe= s, > > > we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNI= NG > > > 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[slo= t]; > > > > > > mutex_lock(&sl->slot_lock); > > > - if (sl->slot_state !=3D DVB_CA_SLOTSTATE_NONE= ) { > > > + if ((sl->slot_state =3D=3D DVB_CA_SLOTSTATE_R= UNNING) || > > > + (sl->slot_state =3D=3D DVB_CA_SLOTSTATE_I= NVALID)) { > > > dvb_ca_en50221_slot_shutdown(ca, slot= ); > > > if (ca->flags & DVB_CA_EN50221_FLAG_I= RQ_CAMCHANGE) > > > dvb_ca_en50221_camchange_irq(= ca->pub, > > > = slot, > > > = DVB_CA_EN50221_CAMCHANGE_INSERTED); > > > } > > > + else { > > > + if (sl->slot_state !=3D DVB_CA_SLOTST= ATE_NONE) { > > > + err =3D -EBUSY; > > > + } > > > + } > > > mutex_unlock(&sl->slot_lock); > > > } > > > ca->next_read_slot =3D 0; > > > -- > > > 2.17.1 > > >