mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Thompson <daniel.thompson@linaro.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	Jingoo Han <jingoohan1@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] backlight: lp855x: Add support ACPI enumeration
Date: Tue, 2 Nov 2021 12:22:53 +0000	[thread overview]
Message-ID: <20211102122253.s4oc2p7hmy7w2qgn@maple.lan> (raw)
In-Reply-To: <20211101185518.306728-3-hdegoede@redhat.com>

On Mon, Nov 01, 2021 at 07:55:17PM +0100, Hans de Goede wrote:
> The Xiaomi Mi Pad 2 tablet uses an ACPI enumerated LP8556 backlight
> controller for its LCD-panel, with a Xiaomi specific ACPI HID of
> "XMCC0001", add support for this.
> 
> Note the new "if (id)" check also fixes a NULL pointer deref when a user
> tries to manually bind the driver from sysfs.
> 
> When CONFIG_ACPI is disabled acpi_match_device() will always return NULL,
> so the lp855x_parse_acpi() call will get optimized away.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/video/backlight/lp855x_bl.c | 70 ++++++++++++++++++++++++-----
>  1 file changed, 60 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index d1d27d5eb0f2..f075ec84acfb 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -338,10 +339,6 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  		return -EINVAL;
>  	}
>  
> -	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata)
> -		return -ENOMEM;
> -
>  	of_property_read_string(node, "bl-name", &pdata->name);
>  	of_property_read_u8(node, "dev-ctrl", &pdata->device_control);
>  	of_property_read_u8(node, "init-brt", &pdata->initial_brightness);

Shouldn't there be a removal of an `lp->pdata = pdata` from somewhere in
this function?


> @@ -379,8 +376,31 @@ static int lp855x_parse_dt(struct lp855x *lp)
>  }
>  #endif
>  
> +static int lp855x_parse_acpi(struct lp855x *lp)
> +{
> +	int ret;
> +
> +	/*
> +	 * On ACPI the device has already been initialized by the firmware

Perhaps nitpicking but ideally I'd like "and is in register mode" here 
since I presume it can also be assumed that everything with this HID
has adopted that).

Other than these, LGTM.


Daniel.

  reply	other threads:[~2021-11-02 12:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 18:55 [PATCH 1/3] backlight: lp855x: Move device_config setting out of lp855x_configure() Hans de Goede
2021-11-01 18:55 ` [PATCH 2/3] backlight: lp855x: Add dev helper variable to lp855x_probe() Hans de Goede
2021-11-02 12:23   ` Daniel Thompson
2021-11-01 18:55 ` [PATCH 3/3] backlight: lp855x: Add support ACPI enumeration Hans de Goede
2021-11-02 12:22   ` Daniel Thompson [this message]
2021-11-02 22:50     ` Hans de Goede
2021-11-02 12:24 ` [PATCH 1/3] backlight: lp855x: Move device_config setting out of lp855x_configure() Daniel Thompson

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=20211102122253.s4oc2p7hmy7w2qgn@maple.lan \
    --to=daniel.thompson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=jingoohan1@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®