linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Input: applespi: fix warnings detected by sparse
@ 2019-07-21  7:06 Ronald Tschalär
  2019-07-21  7:24 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Ronald Tschalär @ 2019-07-21  7:06 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Federico Lorenzi, linux-input, linux-kernel, kbuild test robot

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
---
 drivers/input/keyboard/applespi.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c
index d5defdefbc34..00cd8dccd4f5 100644
--- a/drivers/input/keyboard/applespi.c
+++ b/drivers/input/keyboard/applespi.c
@@ -998,10 +998,14 @@ static inline int le16_to_int(__le16 x)
 static void applespi_debug_update_dimensions(struct applespi_data *applespi,
 					     const struct tp_finger *f)
 {
-	applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x, f->abs_x);
-	applespi->tp_dim_max_x = max_t(int, applespi->tp_dim_max_x, f->abs_x);
-	applespi->tp_dim_min_y = min_t(int, applespi->tp_dim_min_y, f->abs_y);
-	applespi->tp_dim_max_y = max_t(int, applespi->tp_dim_max_y, f->abs_y);
+	applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x,
+				       le16_to_int(f->abs_x));
+	applespi->tp_dim_max_x = max_t(int, applespi->tp_dim_max_x,
+				       le16_to_int(f->abs_x));
+	applespi->tp_dim_min_y = min_t(int, applespi->tp_dim_min_y,
+				       le16_to_int(f->abs_y));
+	applespi->tp_dim_max_y = max_t(int, applespi->tp_dim_max_y,
+				       le16_to_int(f->abs_y));
 }
 
 static int applespi_tp_dim_open(struct inode *inode, struct file *file)
@@ -1653,8 +1657,8 @@ static void applespi_save_bl_level(struct applespi_data *applespi,
 	efi_attr = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS |
 		   EFI_VARIABLE_RUNTIME_ACCESS;
 
-	sts = efivar_entry_set_safe(EFI_BL_LEVEL_NAME, efi_guid, efi_attr, true,
-				    efi_data_len, &efi_data);
+	sts = efivar_entry_set_safe((efi_char16_t *)EFI_BL_LEVEL_NAME, efi_guid,
+				    efi_attr, true, efi_data_len, &efi_data);
 	if (sts)
 		dev_warn(&applespi->spi->dev,
 			 "Error saving backlight level to EFI vars: %d\n", sts);
@@ -2027,7 +2031,7 @@ static const struct acpi_device_id applespi_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, applespi_acpi_match);
 
-const struct dev_pm_ops applespi_pm_ops = {
+static const struct dev_pm_ops applespi_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(applespi_suspend, applespi_resume)
 	.poweroff_late	= applespi_poweroff_late,
 };
-- 
2.21.0


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

* Re: [PATCH 2/2] Input: applespi: fix warnings detected by sparse
  2019-07-21  7:06 [PATCH 2/2] Input: applespi: fix warnings detected by sparse Ronald Tschalär
@ 2019-07-21  7:24 ` Dmitry Torokhov
  2019-07-21  7:59   ` Life is hard, and then you die
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2019-07-21  7:24 UTC (permalink / raw)
  To: Ronald Tschalär
  Cc: Federico Lorenzi, linux-input, linux-kernel, kbuild test robot

On Sun, Jul 21, 2019 at 12:06:29AM -0700, Ronald Tschalär wrote:
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
> ---
>  drivers/input/keyboard/applespi.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c
> index d5defdefbc34..00cd8dccd4f5 100644
> --- a/drivers/input/keyboard/applespi.c
> +++ b/drivers/input/keyboard/applespi.c
> @@ -998,10 +998,14 @@ static inline int le16_to_int(__le16 x)
>  static void applespi_debug_update_dimensions(struct applespi_data *applespi,
>  					     const struct tp_finger *f)
>  {
> -	applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x, f->abs_x);

Should we also make tp_dim_* u16? Then we won't need min_t here.

-- 
Dmitry

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

* Re: [PATCH 2/2] Input: applespi: fix warnings detected by sparse
  2019-07-21  7:24 ` Dmitry Torokhov
@ 2019-07-21  7:59   ` Life is hard, and then you die
  0 siblings, 0 replies; 3+ messages in thread
From: Life is hard, and then you die @ 2019-07-21  7:59 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Federico Lorenzi, linux-input, linux-kernel, kbuild test robot


  Hi Dmitry,

On Sun, Jul 21, 2019 at 10:24:27AM +0300, Dmitry Torokhov wrote:
> On Sun, Jul 21, 2019 at 12:06:29AM -0700, Ronald Tschalär wrote:
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Ronald Tschalär <ronald@innovation.ch>
> > ---
> >  drivers/input/keyboard/applespi.c | 18 +++++++++++-------
> >  1 file changed, 11 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c
> > index d5defdefbc34..00cd8dccd4f5 100644
> > --- a/drivers/input/keyboard/applespi.c
> > +++ b/drivers/input/keyboard/applespi.c
> > @@ -998,10 +998,14 @@ static inline int le16_to_int(__le16 x)
> >  static void applespi_debug_update_dimensions(struct applespi_data *applespi,
> >  					     const struct tp_finger *f)
> >  {
> > -	applespi->tp_dim_min_x = min_t(int, applespi->tp_dim_min_x, f->abs_x);
> 
> Should we also make tp_dim_* u16? Then we won't need min_t here.

abs_x/abs_y are actually signed values and sometimes negative, and
hence tp_dim_min_* are negative here. But we can just replace the
min_t/max_t with min/max, since both args are now int's.


  Cheers,

  Ronald


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

end of thread, other threads:[~2019-07-21  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-21  7:06 [PATCH 2/2] Input: applespi: fix warnings detected by sparse Ronald Tschalär
2019-07-21  7:24 ` Dmitry Torokhov
2019-07-21  7:59   ` Life is hard, and then you die

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).