lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACvgo51dQS4vW1vzn77P+4ygB_6YDXo7ZnZqC97CUDhDsxiE4A@mail.gmail.com>
Date:	Mon, 18 Jul 2016 14:11:54 +0100
From:	Emil Velikov <emil.l.velikov@...il.com>
To:	Vinay Simha BN <simhavcs@...il.com>
Cc:	John Stultz <john.stultz@...aro.org>,
	Sumit Semwal <sumit.semwal@...aro.org>,
	Archit Taneja <archit.taneja@...il.com>,
	Rob Clark <robdclark@...il.com>,
	Jani Nikula <jani.nikula@...ux.intel.com>,
	Thierry Reding <thierry.reding@...il.com>,
	David Airlie <airlied@...ux.ie>,
	"open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/2] drm/dsi: Implement dcs set/get display brightness

On 18 July 2016 at 09:28, Vinay Simha BN <simhavcs@...il.com> wrote:
> Provide a small convenience wrapper that set/get the
> display brightness value
>
> Cc: John Stultz <john.stultz@...aro.org>
> Cc: Sumit Semwal <sumit.semwal@...aro.org>
> Cc: Archit Taneja <archit.taneja@...il.com>
> Cc: Rob Clark <robdclark@...il.com>
> Cc: Jani Nikula <jani.nikula@...ux.intel.com>
> Cc: Thierry Reding <thierry.reding@...il.com>
> Cc: Emil Velikov <emil.l.velikov@...il.com>
> Signed-off-by: Vinay Simha BN <simhavcs@...il.com>
>
> ---
> v1:
>  *tested in nexus7 2nd gen.
>
> v2:
>  * implemented jani review comments
>    -functions name mapped accordingly
>    -bl value increased from 0xff to 0xffff
>    -backlight interface will be handled in panel driver,
>     so it is moved from the mipi_dsi helper function
>
> v3:
>  * emil review comments
>    (err < 0) supposed to be (err <= 0)
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 49 ++++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_mipi_dsi.h     |  4 ++++
>  2 files changed, 53 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index af0d471..43aa743 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -1041,6 +1041,55 @@ int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format)
>  }
>  EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format);
>
> +/**
> + * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
> + * of the display
> + * @dsi: DSI peripheral device
> + * @brightness: brightness value
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
> +                                       u16 *brightness)
> +{
> +       ssize_t err;
> +
> +       err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
> +                               brightness, sizeof(*brightness));
> +       if (err <= 0) {
> +               if (err == 0)
> +                       err = -ENODATA;
> +
Looks better now. Thank you.

> +               return err;
Side note:
When sizeof(ssize_t) != sizeof(int) this might lead to some very
annoying bugs. In practise I doubt anyone uses error codes in the
SSIZE_MIN to INT_MIN range so we should be safe.

Reviewed-by: Emil Velikov <emil.l.velikov@...il.com>

Regards,
Emil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ