All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lg-laptop: Recognize more models
@ 2021-11-23 20:14 Matan Ziv-Av
  2021-11-24 16:30 ` Andy Shevchenko
  2021-11-25 15:36 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Matan Ziv-Av @ 2021-11-23 20:14 UTC (permalink / raw)
  To: Platform Driver; +Cc: Hans de Goede


LG uses 5 instead of 0 in the third digit (second digit after 2019) 
of the year string to indicate newer models in the same year. Handle 
this case as well.

Signed-off-by: Matan Ziv-Av <matan@svgalib.org>
---
  drivers/platform/x86/lg-laptop.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index ae9293024c77..a91847a551a7 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -657,6 +657,18 @@ static int acpi_add(struct acpi_device *device)
  	if (product && strlen(product) > 4)
  		switch (product[4]) {
  		case '5':
+			if (strlen(product) > 5)
+				switch (product[5]) {
+				case 'N':
+					year = 2021;
+					break;
+				case '0':
+					year = 2016;
+					break;
+				default:
+					year = 2022;
+				}
+			break;
  		case '6':
  			year = 2016;
  			break;



-- 
Matan.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lg-laptop: Recognize more models
  2021-11-23 20:14 [PATCH] lg-laptop: Recognize more models Matan Ziv-Av
@ 2021-11-24 16:30 ` Andy Shevchenko
  2021-11-25 15:36 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-11-24 16:30 UTC (permalink / raw)
  To: Matan Ziv-Av; +Cc: Platform Driver, Hans de Goede

On Wed, Nov 24, 2021 at 1:27 AM Matan Ziv-Av <matan@svgalib.org> wrote:

> LG uses 5 instead of 0 in the third digit (second digit after 2019)
> of the year string to indicate newer models in the same year. Handle
> this case as well.

>         if (product && strlen(product) > 4)
>                 switch (product[4]) {
>                 case '5':
> +                       if (strlen(product) > 5)
> +                               switch (product[5]) {
> +                               case 'N':
> +                                       year = 2021;
> +                                       break;
> +                               case '0':
> +                                       year = 2016;
> +                                       break;
> +                               default:
> +                                       year = 2022;
> +                               }
> +                       break;
>                 case '6':
>                         year = 2016;
>                         break;

Actually you may replace all those `if (strlen(product) > $X) {}` and
accompanied indentation level by adding corresponding
  case '\0':
    break;
into the switches, but this is out of scope here as it should be a
separate change, if any.



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lg-laptop: Recognize more models
  2021-11-23 20:14 [PATCH] lg-laptop: Recognize more models Matan Ziv-Av
  2021-11-24 16:30 ` Andy Shevchenko
@ 2021-11-25 15:36 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-11-25 15:36 UTC (permalink / raw)
  To: Matan Ziv-Av, Platform Driver

Hi,

On 11/23/21 21:14, Matan Ziv-Av wrote:
> 
> LG uses 5 instead of 0 in the third digit (second digit after 2019) of the year string to indicate newer models in the same year. Handle this case as well.
> 
> Signed-off-by: Matan Ziv-Av <matan@svgalib.org>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/lg-laptop.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
> index ae9293024c77..a91847a551a7 100644
> --- a/drivers/platform/x86/lg-laptop.c
> +++ b/drivers/platform/x86/lg-laptop.c
> @@ -657,6 +657,18 @@ static int acpi_add(struct acpi_device *device)
>      if (product && strlen(product) > 4)
>          switch (product[4]) {
>          case '5':
> +            if (strlen(product) > 5)
> +                switch (product[5]) {
> +                case 'N':
> +                    year = 2021;
> +                    break;
> +                case '0':
> +                    year = 2016;
> +                    break;
> +                default:
> +                    year = 2022;
> +                }
> +            break;
>          case '6':
>              year = 2016;
>              break;
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-25 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 20:14 [PATCH] lg-laptop: Recognize more models Matan Ziv-Av
2021-11-24 16:30 ` Andy Shevchenko
2021-11-25 15:36 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.