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 10251C4332F for ; Fri, 16 Dec 2022 16:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232147AbiLPQO0 (ORCPT ); Fri, 16 Dec 2022 11:14:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiLPQNv (ORCPT ); Fri, 16 Dec 2022 11:13:51 -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 981E1F6F for ; Fri, 16 Dec 2022 08:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671207179; 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=hy+PGfvhcn+aIJDQHtIiaykQ33Q415T5nMj74OlErM9zF2xprkVRkRJLUWyEtpMjv9vBDW oMa/UbeLlsAOe6CJQyHCMumqW7s4LXZMZZ973fbMSB7rwjNWlDaF5TWth9qdM2p7gqv2QL AuNzQOPcTsC9tUw7v56AWvuLSRFFi/E= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-568-alU738osOvmoT7CbHDtfgA-1; Fri, 16 Dec 2022 11:12:58 -0500 X-MC-Unique: alU738osOvmoT7CbHDtfgA-1 Received: by mail-ed1-f72.google.com with SMTP id g14-20020a056402090e00b0046790cd9082so2214408edz.21 for ; Fri, 16 Dec 2022 08:12:58 -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=FK/97FVV84nNC3/+qT8pTm4+x3zbykkV79Qh5xXxc37DcfKJqr+PaeQYcsdiHmbib6 HPSLDqbjkacRUeoTwtJRT1aIqcQPrSIsUjtOhvPiFfSIypBoqc8nGjroh2ryKnEgIvOn kwCipTU6FrEm9zN1PenYxYNhOWU42b/3/I2lxs+t6XkhwY2pmBOYN6g1AF9iK4er3UR+ PtK3ghjJKsHXmTT5Eh+xbyegplL34edl4uN9gsfd9Az5ZVNe0yjogVgrRsYciUwC0lOT aBx8ED8bzIrGUM14maqdm/44z6yAvoGUiGFiVNRSF1k6t413rxR46sONf84DyBj5L8VP aHIA== X-Gm-Message-State: ANoB5pmsCt+Owl/UDHA/YajFcY43bQQ3oDC+kePuoP2d3ksv0ZVbDgis 5XjOZTDqa1ZYGHI+yRzbXmw8NhxgKnHcIx39TggApqZ1aSVEWPaDohxz8bHLdArWLGxuUjeEZSD sNYPz+tzIpEZHVM4Lf3qWDg== X-Received: by 2002:a17:907:d092:b0:7c1:766e:e09 with SMTP id vc18-20020a170907d09200b007c1766e0e09mr17459140ejc.29.1671207177122; 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-gpio@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; > } > > ? > >> +} >