From patchwork Tue Nov 21 19:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 167915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp877958vqb; Tue, 21 Nov 2023 11:53:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdVGJ1qn/l4T+HFSqcEHr7b9dqwBLVdP/XGJnvAy7YvjnipZtAnMUCwYiMGVs0WewrPukl X-Received: by 2002:a17:902:c1c4:b0:1cf:6967:ec70 with SMTP id c4-20020a170902c1c400b001cf6967ec70mr208986plc.31.1700596438384; Tue, 21 Nov 2023 11:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700596438; cv=none; d=google.com; s=arc-20160816; b=cB9QZdHEx2l0DN5Lk2qebV2r7vVe5u3cLXr87T5e0KTV0nkkh8lIdOg9Ko/z3yOTUJ DJS8sius65O10lCusfwooEvT53kkd/VrPohEFB5PxrPxq+cB9hURYhpVmImujI7yFITU eLDEPaoNeczKkGPRyt6LlnxvD+Nprxdt+KIzFPMtjTyvWMzAI9O7gNrhQspLcvhP5ngI 1EO57mbFrXBUD7hovvW3PDbA8Lu+Yf67rPuzTWdNfi0dP3B20ImPMnBu0blpoOFhxk5L JI/C/pcK+oXxLOuZDs/A34M3eiKre2rPj5kqR8vnAWrcgEtw22UI3P1dhS9jo32/MU04 3uUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=dDCQx2svTZtfCmrCU69fY87fRl7Sd0hrHJUJrOpUR1s=; fh=Olmnw9EiPOHXl6tXYk5T9PPwqL+0H7V+IoxB1uD1V0I=; b=CycOsZ6ZHzns/d1szLDbucfW8FlzpG94uFtFdAMEVizW2cX2y51V+DdwklEpD47KDH x4dm2loWO6/RVeJTJ/zQgxO5rcRBi9pOxU1McVmK6DD+WKI2DmYgpFCxkjzn7iZbXrpF 03amR2LlaZ31zg3KF75o49x0KXe1zFfoWFAMWyxKMhisNe09aJVn+A6wsI7AQRM90QIs tpNOzFZiAdNvnaACbRi4wBAL03BBP4Yro1SOZlG1sYNbD1yVA1r1TXr/DGM/jhfg202u 6xiNmFkQA7UGVp3JuCh8tcnZxZqpYlLXJUwukgulGHGljSVHM8VQY/R2cE7Fd2SgYQVx NCnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XF7p33qx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o18-20020a170902d4d200b001cf75b042fesi717736plg.52.2023.11.21.11.53.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 11:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XF7p33qx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 25836811F103; Tue, 21 Nov 2023 11:53:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbjKUTx5 (ORCPT + 99 others); Tue, 21 Nov 2023 14:53:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjKUTx4 (ORCPT ); Tue, 21 Nov 2023 14:53:56 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D6B18E for ; Tue, 21 Nov 2023 11:53:52 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-6711dd6595fso18849026d6.3 for ; Tue, 21 Nov 2023 11:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1700596432; x=1701201232; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dDCQx2svTZtfCmrCU69fY87fRl7Sd0hrHJUJrOpUR1s=; b=XF7p33qxwVcMCafNsYpOaqKk78Gm78d+4D54vMFD+yOprNN92MfBt03qzL5+F2jlz8 XWsvUjZ+hC/cHjadbCHNFi0qTjjg0IyjFvZDviirZnOF019Ew2SdDdTp8UyKPtg2efZV 1QM2scZ8t/DiL/HnvY62F/XIiPMfAdlzGjMQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700596432; x=1701201232; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dDCQx2svTZtfCmrCU69fY87fRl7Sd0hrHJUJrOpUR1s=; b=kXj/h/3tLpFhnzR4t0rLE1wxn8C2xpTZo/AHQI7oDwgWmtD6qXzliHX00uC4zfwXNP QZkSqbCnuorgLBNJFJ90Z2niXrxjsdMM0U8EpicHD/eCuqIPEOhBWWdIs3S1Y4sWw6A0 5JsJLMJ/7X02HxT3M0mYsNO1VSHhDLShVhWJfxAWqzGueIfccR4ahdGTb6s6Y4hSL57B oMKhI3j1NLJJHJxvvqr4d3zc65soM6PUx0DqTQFzbORgjE3AJ0cMPEJWYzxfJTLgKTKj eL0x3eyD8Ni/MG0C6R0tDTGh81jYhua8x+diXv3kfW8v3haMDlftfRQTlmEr6xLVbwGC vHDQ== X-Gm-Message-State: AOJu0Ywy1HkEBxkfNPbf3eT3gvkGe8ANh0zzrlIG5mB4wtH2sVor2kgb j4dC++ZfvkuKFjqZhmepEwtczg== X-Received: by 2002:a05:6214:21e2:b0:66d:2d07:eab4 with SMTP id p2-20020a05621421e200b0066d2d07eab4mr51485qvj.42.1700596431833; Tue, 21 Nov 2023 11:53:51 -0800 (PST) Received: from denia.c.googlers.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id ct2-20020a056214178200b0065b0d9b4ee7sm4199409qvb.20.2023.11.21.11.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 11:53:51 -0800 (PST) From: Ricardo Ribalda Date: Tue, 21 Nov 2023 19:53:48 +0000 Subject: [PATCH v3 1/3] media: uvcvideo: Always use uvc_status_stop() MIME-Version: 1.0 Message-Id: <20231121-guenter-mini-v3-1-d8a5eae2312b@chromium.org> References: <20231121-guenter-mini-v3-0-d8a5eae2312b@chromium.org> In-Reply-To: <20231121-guenter-mini-v3-0-d8a5eae2312b@chromium.org> To: Mauro Carvalho Chehab Cc: Guenter Roeck , Tomasz Figa , Laurent Pinchart , Alan Stern , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Paul , Ricardo Ribalda , Sakari Ailus X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 11:53:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783204611055307490 X-GMAIL-MSGID: 1783204611055307490 uvc_status_stop() handles properly the race conditions with the asynchronous worker. Let's use uvc_status_stop() for all the code paths that require stopping it. Signed-off-by: Ricardo Ribalda Reviewed-by: Sakari Ailus --- drivers/media/usb/uvc/uvc_ctrl.c | 4 ---- drivers/media/usb/uvc/uvc_status.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index e59a463c2761..8e22a07e3e7b 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2765,10 +2765,6 @@ void uvc_ctrl_cleanup_device(struct uvc_device *dev) struct uvc_entity *entity; unsigned int i; - /* Can be uninitialized if we are aborting on probe error. */ - if (dev->async_ctrl.work.func) - cancel_work_sync(&dev->async_ctrl.work); - /* Free controls and control mappings for all entities. */ list_for_each_entry(entity, &dev->entities, list) { for (i = 0; i < entity->ncontrols; ++i) { diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c index a78a88c710e2..0208612a9f12 100644 --- a/drivers/media/usb/uvc/uvc_status.c +++ b/drivers/media/usb/uvc/uvc_status.c @@ -292,7 +292,7 @@ int uvc_status_init(struct uvc_device *dev) void uvc_status_unregister(struct uvc_device *dev) { - usb_kill_urb(dev->int_urb); + uvc_status_stop(dev); uvc_input_unregister(dev); }