Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3721535yba; Tue, 23 Apr 2019 08:33:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuOYQIOQomv7dky32CBhUJilRbVAb6GsmmJ+Ny7CyUKLU52Y9zmLT3XC4yxWmGfYnROLC1 X-Received: by 2002:a62:ed16:: with SMTP id u22mr27089262pfh.47.1556033587840; Tue, 23 Apr 2019 08:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556033587; cv=none; d=google.com; s=arc-20160816; b=yTRGiWkBNdgiIe6+FynQlqjx7Qmn6413Rhsmqxu+E+n4bTo7ECgMqZLi67xp53sga1 5fuexA2IajeSnevkFbWrZZ848QaKnHpRtum7VfQuA4Dr2/mtpKT+olcc9biniP1BYi8J 3TTC0tlt9EMzFjHB3LL4LN5DswMumPcjfeGu+cCsFEzwHjBCoN60lpuQPUK/mswzosPM Lo8gcaa82uzxLcpPURkcjWk/KC+knpPrize+9WpthtAoMnB2V3XAF0Ze+Ppq5Dhu/IKS yeTVYB0CEbJYE1P6Ov0XlzpQKs2Uva5yGv7lL7cflN1eqOelmKEcmapEziF/+NYxdIPQ c1dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+e1uHCl49NlIYwYl/77X4FaEHdgkmVrIHt2meVWcLZ0=; b=NQjGu3HVx/D0ujqMAw3ft1ivMWpS86PqkrR5lE/KK/CV3FKTeoNxgxfYyD1gUufQ01 dctysapqCXWT9Ab3u2mOqKCX3toHfAxjC4W+b8b9btY1sJ903wm5bEOawwyXNMQZc5/k L4DHzdmFHCaCvsPP0TJig7PEZCJUpo1w+eju0JPNjz621WjORoglrDAJ4k02O6bgtkr+ df+0Q4jVLyYC729O0RuaWVsK5a4hSskWZAF1I7H+nKadfGTguYDRaoH8ZZU5Htg1H4hV VYF0jFQGkBUmXYDu3PHZlq9BuX49eO6+gYKJDsEnhCX84kfWIG5DcJbNzrUfU/+n7p9a dyHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=i+n52ySm; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si5633276pgk.39.2019.04.23.08.32.50; Tue, 23 Apr 2019 08:33:07 -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=@ti.com header.s=ti-com-17Q1 header.b=i+n52ySm; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbfDWPbz (ORCPT + 99 others); Tue, 23 Apr 2019 11:31:55 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47926 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbfDWPbz (ORCPT ); Tue, 23 Apr 2019 11:31:55 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3NFVfec079862; Tue, 23 Apr 2019 10:31:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556033501; bh=+e1uHCl49NlIYwYl/77X4FaEHdgkmVrIHt2meVWcLZ0=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=i+n52ySmT5whPb2kkcmi/HWNv5gEUKoUNSqFr+WeR3HVi1OfLc1qWEqOZqLqhQEs+ hU2Q55CrkSQsZYqKaZdjMX3D3K6QnVxDyQlkbR62OdQnfK3UfXJQk9pfGTY6/rG6YN 4XYNhzfsRItZgCM0TRHiJ4OBhJ4/M9p9PEo2gHIw= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3NFVfEE112806 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Apr 2019 10:31:41 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 23 Apr 2019 10:31:41 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 23 Apr 2019 10:31:41 -0500 Received: from [10.250.90.63] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3NFVeRG055904; Tue, 23 Apr 2019 10:31:40 -0500 Subject: Re: [PATCH v5 3/3] backlight: lm3630a: add firmware node support To: Brian Masney CC: , , , , , , , , , , , , , References: <20190418151143.26068-1-masneyb@onstation.org> <20190418151143.26068-4-masneyb@onstation.org> <20190423140150.GA10071@basecamp> From: Dan Murphy Message-ID: Date: Tue, 23 Apr 2019 10:31:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190423140150.GA10071@basecamp> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Brian 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. Dan > led@0 { > reg = <0>; > led-sources = <0 1>; > label = "lcd-backlight"; > default-brightness = <200>; > }; > > led@1 { > reg = <1>; > default-brightness = <150>; > }; > > Brian >