From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B7B6C4167B for ; Fri, 16 Dec 2022 14:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbiLPODa (ORCPT ); Fri, 16 Dec 2022 09:03:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiLPOD3 (ORCPT ); Fri, 16 Dec 2022 09:03:29 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0AD7A1A6; Fri, 16 Dec 2022 06:03:27 -0800 (PST) X-IronPort-AV: E=McAfee;i="6500,9779,10563"; a="320857507" X-IronPort-AV: E=Sophos;i="5.96,249,1665471600"; d="scan'208";a="320857507" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2022 06:02:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10563"; a="718360916" X-IronPort-AV: E=Sophos;i="5.96,249,1665471600"; d="scan'208";a="718360916" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004.fm.intel.com with ESMTP; 16 Dec 2022 06:02:51 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1p6BIW-00Asqn-29; Fri, 16 Dec 2022 16:02:48 +0200 Date: Fri, 16 Dec 2022 16:02:48 +0200 From: Andy Shevchenko To: Hans de Goede Cc: Mark Gross , Pavel Machek , Lee Jones , Linus Walleij , Daniel Scally , Laurent Pinchart , Mauro Carvalho Chehab , Sakari Ailus , platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org, linux-gpio@vger.kernel.org, Kate Hsuan , Mark Pearson , Andy Yeh , Yao Hao , linux-media@vger.kernel.org Subject: Re: [PATCH v3 06/11] v4l: subdev: Make the v4l2-subdev core code enable/disable the privacy LED if present Message-ID: References: <20221216113013.126881-1-hdegoede@redhat.com> <20221216113013.126881-7-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221216113013.126881-7-hdegoede@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Fri, Dec 16, 2022 at 12:30:08PM +0100, Hans de Goede wrote: > Extend the call_s_stream() wrapper to enable/disable sensor privacy LEDs > for sensors with a privacy LED, rather then having to duplicate this code > in all the sensor drivers. ... > +static void call_s_stream_update_pled(struct v4l2_subdev *sd, int enable) > +{ > + if (!sd->dev) > + return; > + > + /* Try to get privacy-led once, at first s_stream() */ > + if (!sd->privacy_led) > + sd->privacy_led = led_get(sd->dev, "privacy-led"); > + Redundant blank line? > + if (IS_ERR(sd->privacy_led)) > + return; I'm not sure I have got the logic right. Let's assume we call it with _led == NULL. Then in case of error, we feel it with the error pointer. If we call again, we check for NULL, and return error pointer. So, we won't try the second time. Is it by design? Or should it be struct ... *led; if (!privacy_led) { led = ... if (IS_ERR()) return; privacy_led = led; } ? > +} -- With Best Regards, Andy Shevchenko