From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "bp@alien8.de" <bp@alien8.de>, "rjw@rjwysocki.net" <rjw@rjwysocki.net>
Cc: "lenb@kernel.org" <lenb@kernel.org>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"tony.luck@intel.com" <tony.luck@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Subject: Re: [PATCH v3 1/5] ACPI / blacklist: add acpi_match_platform_list()
Date: Mon, 21 Aug 2017 16:41:38 +0000 [thread overview]
Message-ID: <1503333107.2042.163.camel@hpe.com> (raw)
In-Reply-To: <20170821112657.hrtjoeagxhc67rrr@pd.tnic>
On Mon, 2017-08-21 at 13:27 +0200, Borislav Petkov wrote:
> On Fri, Aug 18, 2017 at 01:46:40PM -0600, Toshi Kani wrote:
> > ACPI OEM ID / OEM Table ID / Revision can be used to identify
> > a platform based on ACPI firmware info. acpi_blacklisted(),
> > intel_pstate_platform_pwr_mgmt_exists(), and some other funcs,
> > have been using similar check to detect a list of platforms
> > that require special handlings.
> >
> > Move the platform check in acpi_blacklisted() to a new common
> > utility function, acpi_match_platform_list(), so that other
> > drivers do not have to implement their own version.
> >
> > There is no change in functionality.
:
> > +
> > + for (; plat->oem_id[0]; plat++, idx++) {
> > + if (ACPI_FAILURE(acpi_get_table_header(plat-
> > >table, 0, &hdr)))
> > + continue;
> > +
> > + if (strncmp(plat->oem_id, hdr.oem_id,
> > ACPI_OEM_ID_SIZE))
> > + continue;
> > +
> > + if (strncmp(plat->oem_table_id, hdr.oem_table_id,
> > + ACPI_OEM_TABLE_ID_SIZE))
>
> Let that stick out.
Putting to a single line leads to "line over 80 characters" warning
from checkpatch.pl. Would you still advice to do that?
> > + continue;
> > +
> > + if ((plat->pred == all_versions) ||
> > + (plat->pred == less_than_or_equal
> > + && hdr.oem_revision <= plat->oem_revision)
> > ||
> > + (plat->pred == greater_than_or_equal
> > + && hdr.oem_revision >= plat->oem_revision)
> > ||
> > + (plat->pred == equal
> > + && hdr.oem_revision == plat-
> > >oem_revision))
> > + return idx;
>
> Make that more readable:
>
> if ((plat->pred == all_versions) ||
> (plat->pred == less_than_or_equal &&
> hdr.oem_revision <= plat->oem_revision) ||
> (plat->pred == greater_than_or_equal &&
> hdr.oem_revision >= plat->oem_revision) ||
> (plat->pred == equal &&
> hdr.oem_revision == plat->oem_revision))
> return idx;
Same here. These lead to checkpatch warnings.
> > + }
> > +
> > + return -ENODEV;
> > +}
> > +EXPORT_SYMBOL(acpi_match_platform_list);
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index 27b4b66..a9b6dc2 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -556,6 +556,25 @@ extern acpi_status
> > acpi_pci_osc_control_set(acpi_handle handle,
> > #define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81
> > #define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82
> >
> > +enum acpi_predicate {
> > + all_versions,
> > + less_than_or_equal,
> > + equal,
> > + greater_than_or_equal,
> > +};
> > +
> > +/* Table must be terminted by a NULL entry */
> > +struct acpi_platform_list {
> > + char oem_id[ACPI_OEM_ID_SIZE];
>
> + 1
>
> > + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];
>
> + 1
strncmp() is fine without these, but it'd be prudent in case someone
decides to print these strings with printk(). Will do.
> > + u32 oem_revision;
> > + char *table;
> > + enum acpi_predicate pred;
> > + char *reason;
> > + u32 data;
>
> Ok, turning that into data from is_critical_error is a step in the
> right direction. Let's make it even better:
>
> u32 flags;
>
> and do
>
> #define ACPI_PLAT_IS_CRITICAL_ERROR BIT(0)
>
> so that future elements add new bits instead of wasting a whole u32
> as a boolean.
'data' here is private to the caller. So, I do not think we need to
define the bits. Shall I change the name to 'driver_data' to make it
more explicit?
Thanks,
-Toshi
WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com>
To: "bp@alien8.de" <bp@alien8.de>, "rjw@rjwysocki.net" <rjw@rjwysocki.net>
Cc: "lenb@kernel.org" <lenb@kernel.org>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"tony.luck@intel.com" <tony.luck@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Subject: [v3,1/5] ACPI / blacklist: add acpi_match_platform_list()
Date: Mon, 21 Aug 2017 16:41:38 +0000 [thread overview]
Message-ID: <1503333107.2042.163.camel@hpe.com> (raw)
On Mon, 2017-08-21 at 13:27 +0200, Borislav Petkov wrote:
> On Fri, Aug 18, 2017 at 01:46:40PM -0600, Toshi Kani wrote:
> > ACPI OEM ID / OEM Table ID / Revision can be used to identify
> > a platform based on ACPI firmware info. acpi_blacklisted(),
> > intel_pstate_platform_pwr_mgmt_exists(), and some other funcs,
> > have been using similar check to detect a list of platforms
> > that require special handlings.
> >
> > Move the platform check in acpi_blacklisted() to a new common
> > utility function, acpi_match_platform_list(), so that other
> > drivers do not have to implement their own version.
> >
> > There is no change in functionality.
:
> > +
> > + for (; plat->oem_id[0]; plat++, idx++) {
> > + if (ACPI_FAILURE(acpi_get_table_header(plat-
> > >table, 0, &hdr)))
> > + continue;
> > +
> > + if (strncmp(plat->oem_id, hdr.oem_id,
> > ACPI_OEM_ID_SIZE))
> > + continue;
> > +
> > + if (strncmp(plat->oem_table_id, hdr.oem_table_id,
> > + ACPI_OEM_TABLE_ID_SIZE))
>
> Let that stick out.
Putting to a single line leads to "line over 80 characters" warning
from checkpatch.pl. Would you still advice to do that?
> > + continue;
> > +
> > + if ((plat->pred == all_versions) ||
> > + (plat->pred == less_than_or_equal
> > + && hdr.oem_revision <= plat->oem_revision)
> > ||
> > + (plat->pred == greater_than_or_equal
> > + && hdr.oem_revision >= plat->oem_revision)
> > ||
> > + (plat->pred == equal
> > + && hdr.oem_revision == plat-
> > >oem_revision))
> > + return idx;
>
> Make that more readable:
>
> if ((plat->pred == all_versions) ||
> (plat->pred == less_than_or_equal &&
> hdr.oem_revision <= plat->oem_revision) ||
> (plat->pred == greater_than_or_equal &&
> hdr.oem_revision >= plat->oem_revision) ||
> (plat->pred == equal &&
> hdr.oem_revision == plat->oem_revision))
> return idx;
Same here. These lead to checkpatch warnings.
> > + }
> > +
> > + return -ENODEV;
> > +}
> > +EXPORT_SYMBOL(acpi_match_platform_list);
> > diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> > index 27b4b66..a9b6dc2 100644
> > --- a/include/linux/acpi.h
> > +++ b/include/linux/acpi.h
> > @@ -556,6 +556,25 @@ extern acpi_status
> > acpi_pci_osc_control_set(acpi_handle handle,
> > #define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81
> > #define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82
> >
> > +enum acpi_predicate {
> > + all_versions,
> > + less_than_or_equal,
> > + equal,
> > + greater_than_or_equal,
> > +};
> > +
> > +/* Table must be terminted by a NULL entry */
> > +struct acpi_platform_list {
> > + char oem_id[ACPI_OEM_ID_SIZE];
>
> + 1
>
> > + char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];
>
> + 1
strncmp() is fine without these, but it'd be prudent in case someone
decides to print these strings with printk(). Will do.
> > + u32 oem_revision;
> > + char *table;
> > + enum acpi_predicate pred;
> > + char *reason;
> > + u32 data;
>
> Ok, turning that into data from is_critical_error is a step in the
> right direction. Let's make it even better:
>
> u32 flags;
>
> and do
>
> #define ACPI_PLAT_IS_CRITICAL_ERROR BIT(0)
>
> so that future elements add new bits instead of wasting a whole u32
> as a boolean.
'data' here is private to the caller. So, I do not think we need to
define the bits. Shall I change the name to 'driver_data' to make it
more explicit?
Thanks,
-Toshi
next prev parent reply other threads:[~2017-08-21 16:42 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 19:46 [PATCH v3 0/5] enable ghes_edac on selected platforms Toshi Kani
2017-08-18 19:46 ` [PATCH v3 1/5] ACPI / blacklist: add acpi_match_platform_list() Toshi Kani
2017-08-18 19:46 ` [v3,1/5] " Toshi Kani
2017-08-21 11:27 ` [PATCH v3 1/5] " Borislav Petkov
2017-08-21 11:27 ` [v3,1/5] " Borislav Petkov
2017-08-21 12:25 ` [PATCH v3 1/5] " Rafael J. Wysocki
2017-08-21 12:25 ` [v3,1/5] " Rafael J. Wysocki
2017-08-21 13:20 ` [PATCH] ACPICA: Check whether ACPI is disabled before getting a table Borislav Petkov
2017-08-21 13:20 ` Borislav Petkov
2017-08-21 13:30 ` [PATCH] " Rafael J. Wysocki
2017-08-21 13:30 ` Rafael J. Wysocki
2017-08-21 15:34 ` [PATCH] " Borislav Petkov
2017-08-21 15:34 ` Borislav Petkov
2017-09-03 0:43 ` [PATCH] " kbuild test robot
2017-09-03 0:43 ` kbuild test robot
2017-08-21 16:41 ` Kani, Toshimitsu [this message]
2017-08-21 16:41 ` [v3,1/5] ACPI / blacklist: add acpi_match_platform_list() Toshi Kani
2017-08-21 17:04 ` [PATCH v3 1/5] " Borislav Petkov
2017-08-21 17:04 ` [v3,1/5] " Borislav Petkov
2017-08-21 17:23 ` [PATCH v3 1/5] " Kani, Toshimitsu
2017-08-21 17:23 ` [v3,1/5] " Toshi Kani
2017-08-21 17:36 ` [PATCH v3 1/5] " Borislav Petkov
2017-08-21 17:36 ` [v3,1/5] " Borislav Petkov
2017-08-21 20:31 ` [PATCH v3 1/5] " Rafael J. Wysocki
2017-08-21 20:31 ` [v3,1/5] " Rafael J. Wysocki
2017-08-21 21:06 ` [PATCH v3 1/5] " Kani, Toshimitsu
2017-08-21 21:06 ` [v3,1/5] " Toshi Kani
2017-08-21 21:49 ` [PATCH v3 1/5] " Rafael J. Wysocki
2017-08-21 21:49 ` [v3,1/5] " Rafael J. Wysocki
2017-08-21 22:21 ` [PATCH v3 1/5] " Kani, Toshimitsu
2017-08-21 22:21 ` [v3,1/5] " Toshi Kani
2017-08-21 22:26 ` [PATCH v3 1/5] " Rafael J. Wysocki
2017-08-21 22:26 ` [v3,1/5] " Rafael J. Wysocki
2017-08-18 19:46 ` [PATCH v3 2/5] intel_pstate: convert to use acpi_match_platform_list() Toshi Kani
2017-08-18 19:46 ` [v3,2/5] " Toshi Kani
2017-08-21 17:53 ` [PATCH v3 2/5] " Srinivas Pandruvada
2017-08-21 17:53 ` [v3,2/5] " Srinivas Pandruvada
2017-08-23 15:46 ` [PATCH v3 2/5] " Borislav Petkov
2017-08-23 15:46 ` [v3,2/5] " Borislav Petkov
2017-08-23 15:56 ` [PATCH v3 2/5] " Kani, Toshimitsu
2017-08-23 15:56 ` [v3,2/5] " Toshi Kani
2017-08-18 19:46 ` [PATCH v3 3/5] ghes_edac: add platform check to enable ghes_edac Toshi Kani
2017-08-18 19:46 ` [v3,3/5] " Toshi Kani
2017-08-23 16:20 ` [PATCH v3 3/5] " Borislav Petkov
2017-08-23 16:20 ` Borislav Petkov
2017-08-23 16:20 ` [v3,3/5] " Borislav Petkov
2017-08-23 20:46 ` [PATCH v3 3/5] " Rafael J. Wysocki
2017-08-23 20:46 ` [v3,3/5] " Rafael J. Wysocki
2017-08-24 7:54 ` [PATCH v3 3/5] " Borislav Petkov
2017-08-24 7:54 ` [v3,3/5] " Borislav Petkov
2017-08-18 19:46 ` [PATCH v3 4/5] EDAC: add edac_get_owner() to check MC owner Toshi Kani
2017-08-18 19:46 ` [v3,4/5] " Toshi Kani
2017-08-18 19:46 ` [PATCH v3 5/5] edac drivers: add MC owner check in init Toshi Kani
2017-08-18 19:46 ` [v3,5/5] " Toshi Kani
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=1503333107.2042.163.camel@hpe.com \
--to=toshi.kani@hpe.com \
--cc=bp@alien8.de \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rjw@rjwysocki.net \
--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.