All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Kelsey Skunberg <skunberg.kelsey@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	ACPI Devel Mailing List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	bjorn@helgaas.com, Tony Luck <tony.luck@intel.com>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [PATCH 1/3] ACPI: Remove acpi_has_method() call from acpi_adxl.c
Date: Mon, 22 Jul 2019 13:29:29 -0500	[thread overview]
Message-ID: <20190722182929.GA203187@google.com> (raw)
In-Reply-To: <CAJZ5v0gRzu0bVL+7L9NhbWu5OxveEP8H8v5qpiW-FeOtoOepiw@mail.gmail.com>

[+cc Tony (original author), Borislav (merged original patch)]

On Mon, Jul 22, 2019 at 10:31:11AM +0200, Rafael J. Wysocki wrote:
> On Mon, Jul 22, 2019 at 4:36 AM Kelsey Skunberg
> <skunberg.kelsey@gmail.com> wrote:
> >
> > acpi_check_dsm() will already return an error if the DSM method does not
> > exist. Checking if the DSM method exists before the acpi_check_dsm() call
> > is not needed. Remove acpi_has_method() call to avoid additional work.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> > ---
> >  drivers/acpi/acpi_adxl.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/acpi/acpi_adxl.c b/drivers/acpi/acpi_adxl.c
> > index 13c8f7b50c46..89aac15663fd 100644
> > --- a/drivers/acpi/acpi_adxl.c
> > +++ b/drivers/acpi/acpi_adxl.c
> > @@ -148,11 +148,6 @@ static int __init adxl_init(void)
> >                 return -ENODEV;
> >         }
> >
> > -       if (!acpi_has_method(handle, "_DSM")) {
> > -               pr_info("No DSM method\n");
> 
> And why is printing the message not useful?
> 
> > -               return -ENODEV;
> > -       }
> > -
> >         if (!acpi_check_dsm(handle, &adxl_guid, ADXL_REVISION,
> >                             ADXL_IDX_GET_ADDR_PARAMS |
> >                             ADXL_IDX_FORWARD_TRANSLATE)) {

The next line of context (not included in the patch):

               pr_info("DSM method does not support forward translate\n");

IMHO kernel messages that are just a constant string, with no context
or variable part (device ID, path, error code, etc) are questionable
in general.  Is there any dev_printk()-like thing that takes an
acpi_handle?  Seems like that would be useful for cases like this.

This message *does* include an "ADXL: " prefix (from the pr_fmt
definition), and from reading the code you can see that the only
possible method is "\_SB.ADXL._DSM".

There's nothing an end user can do with these messages, so I suspect
their value is for debugging during platform bringup, and it would be
sufficient to drop the first one (as Kelsey's patch does) and change
the second one like this:

-              pr_info("DSM method does not support forward translate\n");
+              pr_info("%s DSM missing or does not support forward translate\n",
+                      path);

WARNING: multiple messages have this Message-ID (diff)
From: helgaas at kernel.org (Bjorn Helgaas)
Subject: [Linux-kernel-mentees] [PATCH 1/3] ACPI: Remove acpi_has_method() call from acpi_adxl.c
Date: Mon, 22 Jul 2019 13:29:29 -0500	[thread overview]
Message-ID: <20190722182929.GA203187@google.com> (raw)
In-Reply-To: <CAJZ5v0gRzu0bVL+7L9NhbWu5OxveEP8H8v5qpiW-FeOtoOepiw@mail.gmail.com>

[+cc Tony (original author), Borislav (merged original patch)]

On Mon, Jul 22, 2019 at 10:31:11AM +0200, Rafael J. Wysocki wrote:
> On Mon, Jul 22, 2019 at 4:36 AM Kelsey Skunberg
> <skunberg.kelsey at gmail.com> wrote:
> >
> > acpi_check_dsm() will already return an error if the DSM method does not
> > exist. Checking if the DSM method exists before the acpi_check_dsm() call
> > is not needed. Remove acpi_has_method() call to avoid additional work.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey at gmail.com>
> > ---
> >  drivers/acpi/acpi_adxl.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/acpi/acpi_adxl.c b/drivers/acpi/acpi_adxl.c
> > index 13c8f7b50c46..89aac15663fd 100644
> > --- a/drivers/acpi/acpi_adxl.c
> > +++ b/drivers/acpi/acpi_adxl.c
> > @@ -148,11 +148,6 @@ static int __init adxl_init(void)
> >                 return -ENODEV;
> >         }
> >
> > -       if (!acpi_has_method(handle, "_DSM")) {
> > -               pr_info("No DSM method\n");
> 
> And why is printing the message not useful?
> 
> > -               return -ENODEV;
> > -       }
> > -
> >         if (!acpi_check_dsm(handle, &adxl_guid, ADXL_REVISION,
> >                             ADXL_IDX_GET_ADDR_PARAMS |
> >                             ADXL_IDX_FORWARD_TRANSLATE)) {

The next line of context (not included in the patch):

               pr_info("DSM method does not support forward translate\n");

IMHO kernel messages that are just a constant string, with no context
or variable part (device ID, path, error code, etc) are questionable
in general.  Is there any dev_printk()-like thing that takes an
acpi_handle?  Seems like that would be useful for cases like this.

This message *does* include an "ADXL: " prefix (from the pr_fmt
definition), and from reading the code you can see that the only
possible method is "\_SB.ADXL._DSM".

There's nothing an end user can do with these messages, so I suspect
their value is for debugging during platform bringup, and it would be
sufficient to drop the first one (as Kelsey's patch does) and change
the second one like this:

-              pr_info("DSM method does not support forward translate\n");
+              pr_info("%s DSM missing or does not support forward translate\n",
+                      path);

WARNING: multiple messages have this Message-ID (diff)
From: helgaas@kernel.org (Bjorn Helgaas)
Subject: [Linux-kernel-mentees] [PATCH 1/3] ACPI: Remove acpi_has_method() call from acpi_adxl.c
Date: Mon, 22 Jul 2019 13:29:29 -0500	[thread overview]
Message-ID: <20190722182929.GA203187@google.com> (raw)
Message-ID: <20190722182929.lxSDxCn9RpeaWRf-TIv6atxKc7-FRwvDZfNvmZEEUj8@z> (raw)
In-Reply-To: <CAJZ5v0gRzu0bVL+7L9NhbWu5OxveEP8H8v5qpiW-FeOtoOepiw@mail.gmail.com>

[+cc Tony (original author), Borislav (merged original patch)]

On Mon, Jul 22, 2019 at 10:31:11AM +0200, Rafael J. Wysocki wrote:
> On Mon, Jul 22, 2019 at 4:36 AM Kelsey Skunberg
> <skunberg.kelsey at gmail.com> wrote:
> >
> > acpi_check_dsm() will already return an error if the DSM method does not
> > exist. Checking if the DSM method exists before the acpi_check_dsm() call
> > is not needed. Remove acpi_has_method() call to avoid additional work.
> >
> > Signed-off-by: Kelsey Skunberg <skunberg.kelsey at gmail.com>
> > ---
> >  drivers/acpi/acpi_adxl.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/acpi/acpi_adxl.c b/drivers/acpi/acpi_adxl.c
> > index 13c8f7b50c46..89aac15663fd 100644
> > --- a/drivers/acpi/acpi_adxl.c
> > +++ b/drivers/acpi/acpi_adxl.c
> > @@ -148,11 +148,6 @@ static int __init adxl_init(void)
> >                 return -ENODEV;
> >         }
> >
> > -       if (!acpi_has_method(handle, "_DSM")) {
> > -               pr_info("No DSM method\n");
> 
> And why is printing the message not useful?
> 
> > -               return -ENODEV;
> > -       }
> > -
> >         if (!acpi_check_dsm(handle, &adxl_guid, ADXL_REVISION,
> >                             ADXL_IDX_GET_ADDR_PARAMS |
> >                             ADXL_IDX_FORWARD_TRANSLATE)) {

The next line of context (not included in the patch):

               pr_info("DSM method does not support forward translate\n");

IMHO kernel messages that are just a constant string, with no context
or variable part (device ID, path, error code, etc) are questionable
in general.  Is there any dev_printk()-like thing that takes an
acpi_handle?  Seems like that would be useful for cases like this.

This message *does* include an "ADXL: " prefix (from the pr_fmt
definition), and from reading the code you can see that the only
possible method is "\_SB.ADXL._DSM".

There's nothing an end user can do with these messages, so I suspect
their value is for debugging during platform bringup, and it would be
sufficient to drop the first one (as Kelsey's patch does) and change
the second one like this:

-              pr_info("DSM method does not support forward translate\n");
+              pr_info("%s DSM missing or does not support forward translate\n",
+                      path);

  reply	other threads:[~2019-07-22 18:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  2:35 [PATCH 0/3] ACPI: Remove unnecessary acpi_has_method() calls Kelsey Skunberg
2019-07-22  2:35 ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-07-22  2:35 ` skunberg.kelsey
2019-07-22  2:35 ` [PATCH 1/3] ACPI: Remove acpi_has_method() call from acpi_adxl.c Kelsey Skunberg
2019-07-22  2:35   ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-07-22  2:35   ` skunberg.kelsey
2019-07-22  8:31   ` Rafael J. Wysocki
2019-07-22  8:31     ` [Linux-kernel-mentees] " Rafael J. Wysocki
2019-07-22  8:31     ` rafael
2019-07-22 18:29     ` Bjorn Helgaas [this message]
2019-07-22 18:29       ` Bjorn Helgaas
2019-07-22 18:29       ` helgaas
2019-09-02 21:08       ` Rafael J. Wysocki
2019-09-02 21:08         ` [Linux-kernel-mentees] " Rafael J. Wysocki
2019-09-02 21:08         ` rafael
2019-09-05  4:11         ` Kelsey Skunberg
2019-09-05  4:11           ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-09-05  4:11           ` skunberg.kelsey
2019-07-22  2:35 ` [PATCH 2/3] ACPI: Remove acpi_has_method() call from scan.c Kelsey Skunberg
2019-07-22  2:35   ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-07-22  2:35   ` skunberg.kelsey
2019-07-22  8:29   ` Rafael J. Wysocki
2019-07-22  8:29     ` [Linux-kernel-mentees] " Rafael J. Wysocki
2019-07-22  8:29     ` rafael
2019-07-22  2:35 ` [PATCH 3/3] ACPI: Remove acpi_has_method() calls from thermal.c Kelsey Skunberg
2019-07-22  2:35   ` [Linux-kernel-mentees] " Kelsey Skunberg
2019-07-22  2:35   ` skunberg.kelsey

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=20190722182929.GA203187@google.com \
    --to=helgaas@kernel.org \
    --cc=bjorn@helgaas.com \
    --cc=bp@alien8.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=skhan@linuxfoundation.org \
    --cc=skunberg.kelsey@gmail.com \
    --cc=tony.luck@intel.com \
    /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 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.