Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3936833yba; Tue, 23 Apr 2019 12:04:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOSWkO6XCXeMDyXTtF4tNh902pWorNvqIFy4gCLRlUyAwTo8VWOd4uvu1+32DxXISS1sCb X-Received: by 2002:a65:62c9:: with SMTP id m9mr26258223pgv.309.1556046274738; Tue, 23 Apr 2019 12:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556046274; cv=none; d=google.com; s=arc-20160816; b=HJFVDigA/9DgmiJUEMzi3kuxkBrVV+e1LA1k/XGm+HIu+I1R1DmvKORhFrGVsvKdl8 +Cy4sGnt41xzM5NQ1EGBzh97pFf+00JgdehT7lf1OCjGfe8ZMx/qj6+aD+jp+NbmsYO6 U3N5d1vEdVABGJDF6ByXAy6vovJoAYhNXJKjo1Jh25G0LxpFQo4GHhBRUfY1bt+MFJNn rp67IlGWoDS2b7HlUJ244smoFQzty//4InyCB3X9G74zPY0ox8eRIWQqmBN3Ed38qHT8 tkkygBNsosF0T/MZizgfHmEOGJXkABPDZC4PKtSXU6t1tWfD2T0VkXOljvXHOUA8eRRQ HLxA== 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=0eG3Z3S3ocYcBYBvyqgRPxOyST1uSn4qcID8FDy6xc8=; b=TKkThBKQD1PgamBBct4N3s1ySVIV21NUpVQ4KORXo4b9YaupYpDbVMwrwLcBEt9/jN C5axvCRppppLgpxIiQu9x1R4OlC3VNlnU+6aHM5Yx3tmPAYI94scxgQVT968tUdkEB2K lVJpuCrp3t59oUFSkJDq2IitUwr7/DoBLe0MAZuusUgugRk6VE0hBLkMztDPrLQJLaV4 O8z3PNWLK+vbrdccSXrcB45LA8ob3VIh1rdmJCsT5HZGXwPH2kg0iQ8HyLD8X5lKSmVI YzW0aA0hECcDuNDcNzSobi5NUYHRYIXmNOXrQsyqUGNgqbSwBL3Txi6ghXVYNQG4aQg1 Nk2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=syxTjbct; 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 ay3si6033890plb.336.2019.04.23.12.04.19; Tue, 23 Apr 2019 12:04:34 -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=syxTjbct; 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 S1726793AbfDWTDI (ORCPT + 99 others); Tue, 23 Apr 2019 15:03:08 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:33168 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfDWTDI (ORCPT ); Tue, 23 Apr 2019 15:03:08 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3NJ2qqW105466; Tue, 23 Apr 2019 14:02:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556046172; bh=0eG3Z3S3ocYcBYBvyqgRPxOyST1uSn4qcID8FDy6xc8=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=syxTjbct0RIsQkyu1ZEkpozWSknmSpNwZgMnjLXfT7vwY9CsUT4j6BMX3sDZS9P+l UmWhobNAOCe0SRSVOIa2gX72rTJFOOYmqmAv9VOIdf7OgpphigY+Hv2NLhI0+zQekp hVwN+iyidazw6/nr7pu/wByx6op2tEg4Lxi1hEt8= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3NJ2qNG035966 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Apr 2019 14:02:52 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) 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 14:02:51 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE108.ent.ti.com (157.170.170.38) 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 14:02:51 -0500 Received: from [10.250.90.63] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3NJ2pT1020828; Tue, 23 Apr 2019 14:02:51 -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> <20190423160019.GA10501@basecamp> From: Dan Murphy Message-ID: Date: Tue, 23 Apr 2019 14:02:51 -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: <20190423160019.GA10501@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 11:00 AM, Brian Masney wrote: > 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. > OK. Thats another way to do it. I may have just done a return with the value. Otherwise Reviewed-by: Dan Murphy > Brian >