Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3750814yba; Tue, 23 Apr 2019 09:01:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6r5CIYIgTttG0IU3A0XxVmnSslcjqS+DokRvqvQF8NCG6rnUu+AtApz29+3pWVmokurzM X-Received: by 2002:a17:902:b948:: with SMTP id h8mr27040550pls.39.1556035309621; Tue, 23 Apr 2019 09:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556035309; cv=none; d=google.com; s=arc-20160816; b=eSUwMOZ/P/hAOwm8QdQatzyIooV/Ok6sDzZ77jT7bdMjVcfTufosQhyIJZzrh12xJr yWxpDgKHYEzzeaDAxwOKzF6qm7ini1M/VPVJqf23Z+XG0gf6AHHZxulyOda++zrzYp0U luRDloIH+TVgo5CwBj+x5oViErIT0RBzxMLA/oPCjwurnlqvpNGpxH/HmgpyvWTlm+X8 yqTeQq22pmNX4MXmAU5Q0QHhJxLpgyLPK+flinA/SoGbQoCNC+lwheQ5nhNW7YS0RCt8 +xxLcjRQY0ZVzdbJzBqSv8mScmOfdJR/ixflRwED6JbzfmHvhL5s5XPC4/UAg6MdM9K0 dJ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=53xxL//Bk3jvNBnbEeGrVeac6ErjSvT52sjH0zxNxNw=; b=g0yqR8ioZ2IXH39bv5naSbYP9je2xku/SfqPB59ijjN2CLMq3Ljr5jpd5YQMRXaoX9 bQ4OqfWzOYNu5KBKD6zHiqygDCboY4P1qh5g7VcTPIbpHb38Q733qXUcaSFutUkUy12g 5I9m5T9R2dt9/cXoiTvHoxdr5ofjHPLmd28DHCIAl/fXh/pwKpShaS4TVjJEBtvmOkQ/ SR0A7s+Wfs/TEv3mNJNj98AW1braP/yDR0zR1G8tovh0bXEBgt5tL2g7JqVqBSfubqTK Rz8gJymbZuTMtSk5gyErQFW7ZPcVHLPMvxg1LKHSUkbM2gLZD0kqPbgDiHmYJmcmDsn/ PMTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=Q0x5+ToZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q86si16589705pfi.197.2019.04.23.09.01.32; Tue, 23 Apr 2019 09:01:49 -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 (test mode) header.i=@onstation.org header.s=default header.b=Q0x5+ToZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728485AbfDWQAV (ORCPT + 99 others); Tue, 23 Apr 2019 12:00:21 -0400 Received: from onstation.org ([52.200.56.107]:35804 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726655AbfDWQAV (ORCPT ); Tue, 23 Apr 2019 12:00:21 -0400 Received: from localhost (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 04FF03EE68; Tue, 23 Apr 2019 16:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=onstation.org; s=default; t=1556035220; bh=79f0sXsFMx8duETxmH/ylmEuGSQ8rUeZKl2a5HF35VY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q0x5+ToZpuzn0CxXyZhTY0rBmLI0Ys4xsct191KB9SPt/rFogOhsRvy5Yc3cMLKFV EKMTACg6WPEq0eETIpcCYLjIyW1L2e0pUSZ+Knge06AflZncp+u9MH7WF3Kf96Fe+7 5E1sjbRyJjF8WQvl/3dtYAhKhRFKix1OGczwvfjw= Date: Tue, 23 Apr 2019 12:00:19 -0400 From: Brian Masney To: Dan Murphy Cc: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, robh+dt@kernel.org, jacek.anaszewski@gmail.com, pavel@ucw.cz, mark.rutland@arm.com, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, jonathan@marek.ca Subject: Re: [PATCH v5 3/3] backlight: lm3630a: add firmware node support Message-ID: <20190423160019.GA10501@basecamp> References: <20190418151143.26068-1-masneyb@onstation.org> <20190418151143.26068-4-masneyb@onstation.org> <20190423140150.GA10071@basecamp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 10:31:41AM -0500, Dan Murphy wrote: > On 4/23/19 9:01 AM, Brian Masney wrote: > > On Tue, Apr 23, 2019 at 08:49:20AM -0500, Dan Murphy wrote: > >>> +static int lm3630a_parse_led_sources(struct fwnode_handle *node, > >>> + int default_led_sources) > >>> +{ > >>> + u32 sources[LM3630A_NUM_SINKS]; > >>> + int ret, num_sources, i; > >>> + > >>> + num_sources = fwnode_property_read_u32_array(node, "led-sources", NULL, > >>> + 0); > >>> + if (num_sources < 0) > >>> + return default_led_sources; > >>> + else if (num_sources > ARRAY_SIZE(sources)) > >>> + return -EINVAL; > >>> + > >>> + ret = fwnode_property_read_u32_array(node, "led-sources", sources, > >>> + num_sources); > >>> + if (ret) > >>> + return ret; > >>> + > >>> + for (i = 0; i < num_sources; i++) { > >>> + if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) > >>> + return -EINVAL; > >>> + > >>> + ret |= BIT(sources[i]); > >>> + } > >>> + > >>> + return ret; > >>> +} > >>> + > >>> +static int lm3630a_parse_bank(struct lm3630a_platform_data *pdata, > >>> + struct fwnode_handle *node, int *seen_led_sources) > >> > >> Why is seen_led_sources passed in here? > >> It is initialized on the stack in lm3630a_parse_node but the variable is never referenced in that API. > > > > It's to see all of the led-sources that are configured across all of the > > banks. If it is just in lm3630a_parse_bank(), then it won't catch the > > following invalid configuration: > > > > Ok I see what it is for now. > > Not sure why it is declared as a pointer though. It's so that lm3630a_parse_bank() can update that value with the led-sources that have been seen. Otherwise, the changes wouldn't make their way back out to the outer function. Brian