Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp162518lqj; Wed, 10 Apr 2024 07:08:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfRq/KLcoOKQchyqTR/NyKt3jsGRRIZVD2tu5mTNRCm1rscBub6xnO7oDx0kam0H9Eh1kybd86CpA/yg2FBKc/zIWfy04g2HdOvtVmsA== X-Google-Smtp-Source: AGHT+IG3Bl2wF87KZ7xTaGPyboTcWdkJX0YOTK+b2t9J2kX0PHPFi4xTUUbWvxi+KI6hgdS3oCU0 X-Received: by 2002:a2e:990d:0:b0:2d7:1152:d40c with SMTP id v13-20020a2e990d000000b002d71152d40cmr1998278lji.5.1712758130357; Wed, 10 Apr 2024 07:08:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712758130; cv=pass; d=google.com; s=arc-20160816; b=AeRaxK9+B8z/SndndQBqdYdX2m9P3od6Cd+bkiRCUNshbCnry4odoDCDRn0ulNICcF 9STVqHgcyPrCbaf+JIFEBUHNJsG+8xPWBljqxc/jdeALpspzFNWIYGhtXDfopcsmx+kR ZpFz0fj8c7fVw4AoZuVaEh/gUE5yY4vAsS4YXokd4AHW62ywZBhjqtQ8ljVckJazHCXg kHqnWn0+PWj3aZNJhBBL3AcEwsyNsYzdZOkWQrfChV6bkUuBJNGeRqRlcKSn+4bNmVOy LMUk7NMZGgWOJ64zta8/99czDqzBYb4uxVBIMg2k+fGXtJFrvCfeIRSmT/IPbxrXalvt dvQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xYq5oOSlL3kjEAV19jNwGS2lV+9rWNxA6Oy99QYRXhc=; fh=NBK3ruhtCaLDI0S9rBJdyk8Cr8I4RrENvijeAjAKFdE=; b=X/y7nzvHHu/r7hTXJHQS7edVSvVnwC/IDI5bAIN49+bwDTJcEHWcEupVJnxuX0KrY3 18xF8l3dq7Rg33TjpT9OWtUel08/OC8gB9BrqKGI5HmgVETzvKePXOe8GhBu3yI+nSZc BK1xcojoVhfK08raRFC/LtwIGAYY3ZpwgQW9h3X9PFuygP60dN6/4/c2w590W5ItFr2p 2w23ag+ma6NgC9csIPtSjqr67BVthC2qDuuiRN6liYELwqmoLWLotNRBpT3jfzOqMmIR oU60vM9YVSsBIePskUqiaAayZtG44Kiz3whtCZ6N2d8LMYHLEJmezVF7Jq4eN0tSB7hG HT5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="QX/VNOmg"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b5-20020a056402084500b0056e59054e20si3644965edz.613.2024.04.10.07.08.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138293-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=@intel.com header.s=Intel header.b="QX/VNOmg"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138293-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138293-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 28F2F1F22A8D for ; Wed, 10 Apr 2024 10:03:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72ACD158DD0; Wed, 10 Apr 2024 10:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QX/VNOmg" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA0A08F4E; Wed, 10 Apr 2024 10:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712743389; cv=none; b=JL2aSLMgocY+CetdabfeOHXZ7vYgr5JEvU3gwZpsRJ7SSiNbiV5Zr9qejeFwmg2jk0ApsSAZpadeUmZX/O0SX0Us0apQgS6m2QydohfJhjUG4PUgSUH9MS5y0rOij++si1Y8ie/9StinDctmAvo1bqnscAnv9C9LTR4lLt4ENjo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712743389; c=relaxed/simple; bh=PESaPOPG9KlJZbxWL1LM1wMqfUvpvl3bfm2/tdacBQw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BsXceJ/z+9u8W9Kaync1kKRY+dy3riY3jZf7uYqVRuwVdinFdpS529SH9PCQ+25YVhNmwOjDlpMEo2/Hl4t/MqE4PLW+xNKrhh6ynXjTXe6Z/JkHqxTdBGw5MeiaHA1REL3MDaQN53dgjYY5A8ps3f9I5iQwytbdiNRZSwWyksE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QX/VNOmg; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712743387; x=1744279387; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PESaPOPG9KlJZbxWL1LM1wMqfUvpvl3bfm2/tdacBQw=; b=QX/VNOmgo86Vv1uQGXrXBFHPT/oxH3yO33KSL4Zzp7y+nSu5b8mDljVC RbGh4fEO08OD4EJEi0fT/xql50WwLj7htMkQqtX1vWaLwQxu4AhBDraoj 8nWL3Xj8kHDvI7z5FqpsJBW0rt/5Qp+UI6kkwAsGrbDYp81uMPlgAYJVG P+A/+reSzuS0DFBCOkUKTZec08cp5OcoKCoughko71ck3yyJ2XTByUUzh 05tzaLQtJmpj2Ra7hxoInp7Is2miF0PdMmoR8zdqlzvG7RByYuNgpkkD8 DY64Inj6KZQdD6MY340yR0tWvo21Z0qXd41FSkaA1lNj1ito5LCEUKAtk A==; X-CSE-ConnectionGUID: 1XH/mDwDSGKbQmW/wBRIpA== X-CSE-MsgGUID: cQD/xHHLSyW/+zrVHUjZXA== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="11887954" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="11887954" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 03:03:07 -0700 X-CSE-ConnectionGUID: Hsqu5gW0S5KbhhQG3TuwzA== X-CSE-MsgGUID: ruyqUbEYSFmhiGCE9Xl7tA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="25193688" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 03:03:05 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 9F0E311FC46; Wed, 10 Apr 2024 13:03:01 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: tomi.valkeinen@ideasonboard.com, Hans de Goede , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Umang Jain , linux-kernel@vger.kernel.org Subject: [PATCH 1/1] media: v4l: Don't turn on privacy LED if streamon fails Date: Wed, 10 Apr 2024 13:03:01 +0300 Message-Id: <20240410100301.658824-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Turn on the privacy LED only if streamon succeeds. This can be done after enabling streaming on the sensor. Fixes: b6e10ff6c23d ("media: v4l2-core: Make the v4l2-core code enable/disable the privacy LED if present") Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-subdev.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 4c6198c48dd6..acb7c3003ab6 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -412,15 +412,6 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable) if (WARN_ON(!!sd->enabled_streams == !!enable)) return 0; -#if IS_REACHABLE(CONFIG_LEDS_CLASS) - if (!IS_ERR_OR_NULL(sd->privacy_led)) { - if (enable) - led_set_brightness(sd->privacy_led, - sd->privacy_led->max_brightness); - else - led_set_brightness(sd->privacy_led, 0); - } -#endif ret = sd->ops->video->s_stream(sd, enable); if (!enable && ret < 0) { @@ -431,6 +422,16 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable) if (!ret) sd->enabled_streams = enable ? BIT(0) : 0; +#if IS_REACHABLE(CONFIG_LEDS_CLASS) + if (!IS_ERR_OR_NULL(sd->privacy_led) && !(enable && ret < 0)) { + if (enable) + led_set_brightness(sd->privacy_led, + sd->privacy_led->max_brightness); + else + led_set_brightness(sd->privacy_led, 0); + } +#endif + return ret; } -- 2.39.2