# Re: \[PATCH 1/4\] pwm\_backlight: Fix PWM levels support in non DT case

- From: Thierry Reding \<hidden\>
- Date: 2013-01-28 21:01:49 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2013/01/3992293
- Thread: https://ratatoskr.run/linux-fbdev/2013/01/3988271/t.md

```text
On Tue, Jan 22, 2013 at 02:39:53PM +0100, Peter Ujfalusi wrote:
> It is expected that board files would have:
> static unsigned int bl_levels[] = { 0, 50, 100, 150, 200, 250, };
> 
> static struct platform_pwm_backlight_data bl_data = {
> 	.levels = bl_levels,
> 	.max_brightness = ARRAY_SIZE(bl_levels),
> 	.dft_brightness = 4,
> 	.pwm_period_ns = 7812500,
> };
> 
> In this case the max_brightness would be out of range in the levels array.
> Decrement the received max_brightness in every case (DT or non DT) when the
> levels has been provided.

What's wrong with specifying .max_brightness = ARRAY_SIZE(bl_levels) - 1
instead?

Thierry
```

## Attachments

- [(unnamed)](https://ratatoskr.run/linux-fbdev/2013/01/3992293/attachment/0) (application/pgp-signature, 836 bytes)
