Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp172366lqj; Wed, 10 Apr 2024 07:22:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmNZnXmy1e/dWUMZ9n9pjvh4EtrhIE21eeMfOhis19OBQqx5iH9tU3eiN2hAn/TfkH4xEZOA5RabgtbH9WoTVD1OlqVjyOgZ2YQP/8gw== X-Google-Smtp-Source: AGHT+IHccfopKei/kNMyAV/ABanj5+aINfjpM4rOZ5CiLyalM5wDduVBlgTCYOZpzgyeSdbCe7cB X-Received: by 2002:a05:6870:658b:b0:22e:9a75:d5eb with SMTP id fp11-20020a056870658b00b0022e9a75d5ebmr2982517oab.12.1712758938922; Wed, 10 Apr 2024 07:22:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712758938; cv=pass; d=google.com; s=arc-20160816; b=m62iWJvNg8dJ/A6vSvonZDX4Cj5JnWXVFMJ0xYKQqCpU/K4s7CluLiWs86G9J3W9KT n1bm6pazSe9za6gPTpi3LjBHMo/6CTTmZQHFZE9TZdsrvuB7KtJqw9uBxAISrD1s3yqL 9vydt+QO6BgQ7RTt/QdepPqQdnZjnL5QEk0yzt7exnKHwJH9a5OPS2hyl+Bf5FQi3o4N FvjA5BaARx/rPMwq0BqhXIThGnqdkKqQQN+HtvROaj453ntocyEroYu89iZfT9fyPYKW JQYowKPMbd4r4TnTYrmhHPNV06p2blvLKzHhUoQnQhxsT4nS6C9bS+jN2MTjYLvWUnWy rkcQ== 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=6DD57VrC9op8BYD0lV4Xrysyc0LFsPtY/S/PlU+LiXQ=; fh=NBK3ruhtCaLDI0S9rBJdyk8Cr8I4RrENvijeAjAKFdE=; b=W730aAqXIaENiQNUBGNBoPh912Vq7U6yVPePcd4y34djvr00nn7DSeV1PJe59qQFoi pLtbEvl/9TkJDux57pO30mG3F2D6WinWAzND+zBntKO7jTXY1IUh44lhYUPrIGnpUjqR 4jrOn4iwo+9bw0OYBEueK7F8UQyfOe+d36nAc6hligV2tMZNybfF+9Sp0NPtVHvBchy2 1FfNWpRzuCyCOOvD8Hy8IhxpMyoeIdFT6vOFVX40QlNORStSYXlAj4xkT3WO96FZTblw Qm6IT5WjVc2bH2EsISvhOpZkzEII35qo1tUVNyoIC51zandLKVsGYrlHh5ywSL6ER78A VHQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tq3Hu+oo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138432-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y5-20020ae9f405000000b0078d68d65470si5232932qkl.569.2024.04.10.07.22.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tq3Hu+oo; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-138432-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138432-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4ACD51C232D2 for ; Wed, 10 Apr 2024 11:47:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 568FA15ADAA; Wed, 10 Apr 2024 11:47:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tq3Hu+oo" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 09A76159589; Wed, 10 Apr 2024 11:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712749640; cv=none; b=t0Te+o1xLUs+XHnSv8+E2b3R+nIAj9/sq7HOuJWfCuOLbb70sKvP5u+43LudcPCCAo/w7f3jLP+CUKwOmA2vi/7rs80l7rSfQA6PthQPr74KTOe21AWSXX8iELT1oexNV2R7IC5SElT+I8lR75UU+RSWo7Q5VQY0AgT9RUFz+sQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712749640; c=relaxed/simple; bh=6ZUpQRQfMAOGNZsK9PQ1Cubb6lWLTvq0Q4yRruNIE0Q=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Xi30sL3msaNsks41hW4zlKZlr+6WnTw08pvXKf8T216B4j8NX4NYszYR3WqLYWVPVjvZJnBgYlgag1eXDiFysvFma47hPSHwc5MfFDdRk3us4BnI7XK3POHYXQqoRQ6Sd1kLBk085OPfCgolmrtH5BOI6Dj13mt3fWox9Lw86FY= 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=Tq3Hu+oo; arc=none smtp.client-ip=198.175.65.19 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=1712749639; x=1744285639; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6ZUpQRQfMAOGNZsK9PQ1Cubb6lWLTvq0Q4yRruNIE0Q=; b=Tq3Hu+ooYljq/5H4j2YagTD9UB33edlrfbODVcoFfCWkbvaLLscM1MWw 68OFj+8qFXJ1fKw3ZI03Qrf63r8ZTfKTGpS6d2eDD4rz8l66OzjBIksz3 j1GFC162ydNXf336gaIcxkLX7mL0oHjF6bIz8a5pg/pmnpRGcgkQc+xco IIQueBwy0AhmDAvuwckiiSO5ecxTgk43gUdtvIHXBXuOJTQCQcFSPAdFj XGjNV57txGM/FRgG4kdQ5AEXa6TSk32t3icueEzRQuVoYt5U9AVZhJcsB HufaIj1nHWjH1CNAL8kzd2slcJoZ6RUcEXU1xWadBYpUCFBHJhpm9naWa Q==; X-CSE-ConnectionGUID: EWYUZ0CqQ/ykdwpuevqLXw== X-CSE-MsgGUID: c4vYJ/Z0RpCL5+at9ul/7g== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="7977929" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="7977929" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 04:47:18 -0700 X-CSE-ConnectionGUID: bHAUoJrLRreGVN5yUJy3oQ== X-CSE-MsgGUID: K7Ud7PSCQ1SeBDQ7TpzYSw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="51752533" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2024 04:47:16 -0700 Received: from svinhufvud.ger.corp.intel.com (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 04F681203E6; Wed, 10 Apr 2024 14:47:12 +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 v2 1/1] media: v4l: Don't turn on privacy LED if streamon fails Date: Wed, 10 Apr 2024 14:47:12 +0300 Message-Id: <20240410114712.661186-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 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 4c6198c48dd6..012b757eac9f 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) { @@ -428,9 +419,20 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable) ret = 0; } - if (!ret) + if (!ret) { sd->enabled_streams = enable ? BIT(0) : 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 + } + return ret; } -- 2.39.2