From: andy.shevchenko@gmail.com
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-acpi@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH v2 2/2] ACPI: property: Ignore bad graph port nodes on Dell XPS 9315
Date: Wed, 21 Feb 2024 00:21:13 +0200 [thread overview]
Message-ID: <ZdUl2eg8hM5RkrOL@surfacebook.localdomain> (raw)
In-Reply-To: <20240213134606.383817-3-sakari.ailus@linux.intel.com>
Tue, Feb 13, 2024 at 03:46:06PM +0200, Sakari Ailus kirjoitti:
> Some systems were shipped with both Windows and Linux camera descriptions.
> In general, if Linux description exist, they will be used and Windows
> description ignored.
>
> In this case the Linux descriptions were buggy so use Windows definition
> instead. This patch ignores the bad graph port nodes on Dell XPS 9315 and
> there are likely other such systems, too. The corresponding information
> has been added to ipu-bridge to cover the missing bits.
...
> void acpi_mipi_scan_crs_csi2(void);
> void acpi_mipi_init_crs_csi2_swnodes(void);
> void acpi_mipi_crs_csi2_cleanup(void);
+ blank line?
> +bool acpi_graph_ignore_port(acpi_handle handle);
>
> #endif /* _ACPI_INTERNAL_H_ */
...
> +static const struct dmi_system_id dmi_ignore_port_nodes[] = {
> + {
> + .matches = {
> + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
> + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 9315"),
> + },
> + },
> + { 0 }
0 is not needed. Moreover, it's a bit unusual.
> +};
...
> +static const char *strnext(const char *s1, const char *s2)
> +{
> + s1 = strstr(s1, s2);
> +
> + if (!s1)
> + return NULL;
> +
> + return s1 + strlen(s2);
> +}
NIH str_has_prefix() ?
...
> +/**
> + * acpi_graph_ignore_port - Tell whether a port node should be ignored
> + * @handle: The ACPI handle of the node (which may be a port node)
> + *
> + * Returns true if a port node should be ignored and the data to that should
Please, run kernel-doc validation and fix the warnings.
> + * come from other sources instead (Windows ACPI definitions and
> + * ipu-bridge). This is currently used to ignore bad port nodes related to IPU6
> + * ("IPU?") and camera sensor devices ("LNK?") in certain Dell systems with
> + * Intel VSC.
> + */
> +bool acpi_graph_ignore_port(acpi_handle handle)
> +{
> + const char *path = NULL, *orig_path;
> + static bool dmi_tested, ignore_port;
> +
> + if (!dmi_tested) {
> + ignore_port = dmi_first_match(dmi_ignore_port_nodes);
> + dmi_tested = true;
> + }
> +
> + if (!ignore_port)
> + return false;
> +
> + /* Check if the device is either "IPU" or "LNK" (sensor). */
> + orig_path = acpi_handle_path(handle);
> + if (!orig_path)
> + return false;
> + path = strnext(orig_path, "IPU");
IIUC this can be rewritten as
path += str_has_prefix();
if (path == orig_path)
...
> + if (!path)
> + path = strnext(orig_path, "LNK");
> + if (!path)
> + goto out_free;
> +
> + if (!(path[0] >= '0' && path[0] <= '9' && path[1] == '.'))
isdigit() ?
> + goto out_free;
> +
> + /* Check if the node has a "PRT" prefix. */
> + path = strnext(path, "PRT");
> + if (path && path[0] >= '0' && path[0] <= '9' && !path[1]) {
Ditto.
> + acpi_handle_debug(handle, "ignoring data node\n");
> +
> + kfree(orig_path);
> + return true;
> + }
> +
> +out_free:
> + kfree(orig_path);
> + return false;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-02-20 22:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 13:46 [PATCH v2 0/2] Ignore bad graph port nodes on Dell XPS 9315 Sakari Ailus
2024-02-13 13:46 ` [PATCH v2 1/2] ACPI: utils: Make acpi_handle_path() not static Sakari Ailus
2024-02-13 13:46 ` [PATCH v2 2/2] ACPI: property: Ignore bad graph port nodes on Dell XPS 9315 Sakari Ailus
2024-02-15 20:07 ` Rafael J. Wysocki
2024-02-20 22:21 ` andy.shevchenko [this message]
2024-02-21 6:56 ` Sakari Ailus
2024-02-21 15:33 ` Andy Shevchenko
2024-02-22 12:23 ` Sakari Ailus
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=ZdUl2eg8hM5RkrOL@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox