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 C3A1BC001B2 for ; Fri, 16 Dec 2022 16:14:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbiLPQOa (ORCPT ); Fri, 16 Dec 2022 11:14:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbiLPQNz (ORCPT ); Fri, 16 Dec 2022 11:13:55 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 798EE1173 for ; Fri, 16 Dec 2022 08:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671207180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wURGvGbeXFElQK+1JoCJWdzCOYSxxIx6OSpE5tUptwQ=; b=UkGIR9f1/mIdMkrHlGWgxJGXsYkfMloFFCaFQcqLfAA19Cruf2Ct++iZwVIyq3m7JWxM6Q 0aiKrkkpK4zxswnGVIRAbUSAPXzLXpJ648L25/47LSLtTJwh40Ew4RcKKXzKC0XliqzVtz /I9NEFMjy/ywReCanQPk5u4Sdl1xvEQ= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-490-fUV0A_utNeut8Td0tfo1_A-1; Fri, 16 Dec 2022 11:12:58 -0500 X-MC-Unique: fUV0A_utNeut8Td0tfo1_A-1 Received: by mail-ej1-f71.google.com with SMTP id sg39-20020a170907a42700b007c19b10a747so2140839ejc.11 for ; Fri, 16 Dec 2022 08:12:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wURGvGbeXFElQK+1JoCJWdzCOYSxxIx6OSpE5tUptwQ=; b=351RBJq1bc9kIdLRnHSVad96e4xAEITGRHAdNNH6oDdBddK4u1hUujGi0b+XlkoxZb tS4nBk6UDQq3btSxS4hnTRuXVQWTCBcYVUvxYu1cmSYQ7sJhXMm2Sgb5wlkg+O9ql2pM iOzDM5uor4n02A2tWzE1VbztjZBy+9pijKXCqMjp9lUFgTKBRjl+W/6S/ddMv5Mu792I 3qMLLpDzoZMNYWoWeT5HMC01JET6xs38uYWQ+mPh1cdS7ePkoqO2yEF28B00nBUrXao2 NI1pgcMm2OQWfdeSs8wUkY3nN3ahFaPfOd57RLrXmGsUNmxgYjIjOiHW1bCk9U2xXIJI dTKw== X-Gm-Message-State: ANoB5plpl+8H+29EE1cHsxqdK/brElzszmzXwa3J6TYGvl7ACz5FO8up +DmpFTLuzhp5W//JqbDLWp9wcgdRzTD36O5ku3Lt+6zzaFDaw3X71Gx+4ChX/68mhEmVn+5tT9o OBBHU2WGvD5Wk/TUcFrn1hw== X-Received: by 2002:a17:907:d092:b0:7c1:766e:e09 with SMTP id vc18-20020a170907d09200b007c1766e0e09mr17459147ejc.29.1671207177124; Fri, 16 Dec 2022 08:12:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf50iqeefJRduXX2rwzez9VdVVpN5fpmMgPeScO7DIs4zfQlUWkH2nwxx+hx/Hf6EtQCQOtCxw== X-Received: by 2002:a17:907:d092:b0:7c1:766e:e09 with SMTP id vc18-20020a170907d09200b007c1766e0e09mr17459133ejc.29.1671207177009; Fri, 16 Dec 2022 08:12:57 -0800 (PST) Received: from ?IPV6:2001:1c00:2a07:3a01:67e5:daf9:cec0:df6? (2001-1c00-2a07-3a01-67e5-daf9-cec0-0df6.cable.dynamic.v6.ziggo.nl. [2001:1c00:2a07:3a01:67e5:daf9:cec0:df6]) by smtp.gmail.com with ESMTPSA id co18-20020a0564020c1200b004611c230bd0sm1034983edb.37.2022.12.16.08.12.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 08:12:56 -0800 (PST) Message-ID: Date: Fri, 16 Dec 2022 17:12:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v3 06/11] v4l: subdev: Make the v4l2-subdev core code enable/disable the privacy LED if present Content-Language: en-US To: Andy Shevchenko 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 References: <20221216113013.126881-1-hdegoede@redhat.com> <20221216113013.126881-7-hdegoede@redhat.com> From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Hi, On 12/16/22 15:02, Andy Shevchenko wrote: > 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? I find this more readable with the blank line between the 2 ifs. > >> + 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 It is by design, there even is a comment which says so: /* Try to get privacy-led once, at first s_stream() */ Regards, Hans > > struct ... *led; > > if (!privacy_led) { > led = ... > if (IS_ERR()) > return; > privacy_led = led; > } > > ? > >> +} >