linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Masney <masneyb@onstation.org>
To: Dan Murphy <dmurphy@ti.com>
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
Date: Tue, 23 Apr 2019 14:01:50 +0000	[thread overview]
Message-ID: <20190423140150.GA10071@basecamp> (raw)
In-Reply-To: <dc20ab5d-8c44-78a8-3ebc-7fefe8aaf2d5@ti.com>

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:

led@0 {
	reg = <0>;
	led-sources = <0 1>;
	label = "lcd-backlight";
	default-brightness = <200>;
};

led@1 {
	reg = <1>;
	default-brightness = <150>;
};

Brian

  reply	other threads:[~2019-04-23 14:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 15:11 [PATCH v5 0/3] backlight: lm3630a: bug fix and fwnode support Brian Masney
2019-04-18 15:11 ` [PATCH v5 1/3] backlight: lm3630a: return 0 on success in update_status functions Brian Masney
2019-04-18 15:11 ` [PATCH v5 2/3] dt-bindings: backlight: add lm3630a bindings Brian Masney
2019-04-24  1:52   ` Rob Herring
2019-04-18 15:11 ` [PATCH v5 3/3] backlight: lm3630a: add firmware node support Brian Masney
2019-04-23 13:49   ` Dan Murphy
2019-04-23 14:01     ` Brian Masney [this message]
2019-04-23 15:31       ` Dan Murphy
2019-04-23 16:00         ` Brian Masney
2019-04-23 19:02           ` Dan Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423140150.GA10071@basecamp \
    --to=masneyb@onstation.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.thompson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=jingoohan1@gmail.com \
    --cc=jonathan@marek.ca \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).