Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4398460ybi; Mon, 15 Jul 2019 08:20:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqEFLwJHw9SGU9MBc0hYsVreZLn766SFhhAhKtHrz8zX7mH2lgd9rt72yzK1RlS0x9jMCi X-Received: by 2002:a17:902:a03:: with SMTP id 3mr28616730plo.302.1563204024188; Mon, 15 Jul 2019 08:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563204024; cv=none; d=google.com; s=arc-20160816; b=ROqrxx41qw3USlMlY4GWt6cmV5Wu+j6y6ygFv4yxu6TlWa7R/p1udRiOhExUNiAGVb t2rXYfMXUQrpBYM87HAdN9EHrtWqgIahn8eLwfBq6lOXJAOnwx21KlpjFdVx02DzEEZ2 QEjRkael4lG9W3Z9Y79ULdZLohrDQmtcaEkXBXr4WsesM1YMfWFFOlkV+wCiaOiwYfYt FJxpDiYKSmc+i0yigNplBkJMFZ68sDHaI0c/kmQ5JLo+P2fgpXaSDxEB9ySTCUIP+pwL TJyCgvj8MqpRs0ACsGPzZyTX/a1JWXxOdfn3XVisDWADnU5M2lYo8Gcaf9WPKrmWXHF4 Qskw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HHztAI/ZQoVWsQtGtZCm40CW/6TH0AHaPswdjI5N1oQ=; b=vTJIAUXp/34YPGo1inFzO9vyiDF91JQQe9ckl2ZAQKBsBkjXTIEYXShWvCABhJibW0 2+sBY8gMF6LLt34Z8EzQeTbvybCjg3p6IcIVGJ61l3AUZlxGaIevDi3KvG79oDM2oVcY Cht5lXybyRwu1P8BRD3kxraJ7YljY36NtSWH9EGbpIsGVaa/2hxRgDT+x6WZR1cnNqrX DQZ6sZZEu7ScjqoGl5ZFZSLFUG7vZZDvMo5pP94FNXpxgLtocyi2LJ4Ocan+e57hNTUW ACe6JEkYn8m/wWTMZKPEGyyvX3KHJ5Kekj9RXbMSNHxrURIFQgb9WQqsa9Zv4HVWOcQ4 7X5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUMMPxaN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si15543314pjs.95.2019.07.15.08.20.07; Mon, 15 Jul 2019 08:20:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUMMPxaN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730909AbfGOPTs (ORCPT + 99 others); Mon, 15 Jul 2019 11:19:48 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38769 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730548AbfGOPTs (ORCPT ); Mon, 15 Jul 2019 11:19:48 -0400 Received: by mail-wm1-f66.google.com with SMTP id s15so15636717wmj.3 for ; Mon, 15 Jul 2019 08:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=HHztAI/ZQoVWsQtGtZCm40CW/6TH0AHaPswdjI5N1oQ=; b=mUMMPxaN+YcHfpcJeojEBde29eKqocO/DZ1FrwPpV6dC9y5f09wS6nUZWtc1tMnLuv w1kky1RxU5cFckBDOOsmjWc6qYct//DeNf8lxmicE6v2alZlhbSJz6c4C/KTNLJ/NA3Z eeJTQAV39FIouQXo3wyEP2I89bFZZ03QLZagts2eWDi6VbA3euGhZJVipzVo2tj6gV54 Tmpzw9J9q5/e8rTXDKIulB1VPt46+sQK52s6i9iDNLp1KI6YMxCiadbheJTFkSEHc/JO nImamz6P3N1doomh0IYSSJz9EvXtQ9g/pMZQXiO/PcBiGaTT9aLek769kEERYMBnVIyH c7lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=HHztAI/ZQoVWsQtGtZCm40CW/6TH0AHaPswdjI5N1oQ=; b=kKJOfxSbphhh/N+Hw1kvJbgAgV4KpqrSBGNR6lq4GZbCgsvXe3uBY6cvcoZs3EaXtr 2diSptTPsNvK3DBJAiDNgiGked//uORs3lkTbPpmYuBfGzHRM3bNLoF/z9XkHs+hsSJ3 eHRVx+1y+WdBlKtLXkVnojhb1ZdxLCTarBOjatd+9jkQFum58J+LvX/L6hDnkMqjMdo6 XFiNL5iqx+u7dL2/u17tMgUn+DsMJM+96pYrpLLclk/NOUHO/JrL7rhsW+o3nGRDeLMB YEYUG9e7FWDeXJKrnQH6cnn3Xy4WUp6kHXAYwDMssaATfc1Ub9eWld6r9pndinkmE1yn dcxQ== X-Gm-Message-State: APjAAAWLIPqpbmWuCaKXknZZFlswE3LsTkwBc8SqOt7v9FEdPar4ZgaZ j8YSKIYoC1HXHXLPcBL+iWNVeKfDVWT5bA== X-Received: by 2002:a05:600c:2146:: with SMTP id v6mr24391543wml.59.1563203985761; Mon, 15 Jul 2019 08:19:45 -0700 (PDT) Received: from holly.lan (82-132-244-224.dab.02.net. [82.132.244.224]) by smtp.gmail.com with ESMTPSA id g17sm13049119wrm.7.2019.07.15.08.19.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 08:19:44 -0700 (PDT) Date: Mon, 15 Jul 2019 16:19:35 +0100 From: Daniel Thompson To: Jean-Jacques Hiblot Cc: Dan Murphy , jacek.anaszewski@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, mark.rutland@arm.com, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 1/2] leds: Add control of the voltage/current regulator to the LED core Message-ID: <20190715151935.4ci23aqw4liz56fg@holly.lan> References: <20190708103547.23528-1-jjhiblot@ti.com> <20190708103547.23528-2-jjhiblot@ti.com> <56d16260-ff82-3439-4c1f-2a3a1552bc7d@ti.com> <20190715092400.sedjumqkecglheyu@holly.lan> <9c53f54f-d0d4-50d4-09da-34389085269a@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9c53f54f-d0d4-50d4-09da-34389085269a@ti.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 15, 2019 at 11:47:08AM +0200, Jean-Jacques Hiblot wrote: > > > > > +??? if (IS_ERR(led_cdev->regulator)) { > > > > > +??????? dev_err(led_cdev->dev, "Cannot get the power supply for %s\n", > > > > > +??????????? led_cdev->name); > > > > > +??????? device_unregister(led_cdev->dev); > > > > > +??????? mutex_unlock(&led_cdev->led_access); > > > > > +??????? return PTR_ERR(led_cdev->regulator); > > > > This is listed as optional in the DT doc.? This appears to be required. > > > The regulator core will provide a dummy regulator if none is given in the > > > device tree. I would rather have an error in that case, but that is not how > > > it works. > > If you actively wanted to get -ENODEV back when there is no regulator > > then you can use devm_regulator_get_optional() for that. > > > > However perhaps be careful what you wish for. If you use get_optional() > > then you will have to sprinkle NULL or IS_ERR() checks everywhere. I'd > > favour using the current approach! > > Thanks for the info. I think I'll use the get_optionnal(). That will add a > bit of complexity, but it will avoid deferring some work in > led_set_brightness_nopm() when it is not needed. Makes sense, I didn't notice that it allows you to avoid deferred work. Daniel.