[PATCH v6 4/4] ACPI: NHLT: Streamline struct naming

Cezary Rojewski
2024-03-08T07:31:02Z

Few recently introduced structs are named 'nhlt2' instead of 'nhlt' to
avoid naming conflicts. With duplicate types gone, the conflicts are no
more.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
drivers/acpi/nhlt.c | 36 ++++++++++++++++-----------------
include/acpi/actbl2.h | 22 ++++++++++-----------
include/acpi/nhlt.h | 46 +++++++++++++++++++++----------------------
3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/acpi/nhlt.c b/drivers/acpi/nhlt.c
index 4a0e39ca89e9..b161444a6c3a 100644
--- a/drivers/acpi/nhlt.c
+++ b/drivers/acpi/nhlt.c
@@ -11,9 +11,9 @@
#include <linux/export.h>
#include <acpi/nhlt.h>

-static struct acpi_table_nhlt2 *acpi_gbl_nhlt;
+static struct acpi_table_nhlt *acpi_gbl_nhlt;

-static struct acpi_table_nhlt2 empty_nhlt = {
+static struct acpi_table_nhlt empty_nhlt = {
.header = {
.signature = ACPI_SIG_NHLT,
},
@@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_put_gbl_table);
*
* Return: %true if endpoint matches specified criteria or %false otherwise.
*/
-bool acpi_nhlt_endpoint_match(const struct acpi_nhlt2_endpoint *ep,
+bool acpi_nhlt_endpoint_match(const struct acpi_nhlt_endpoint *ep,
int link_type, int dev_type, int dir, int bus_id)
{
return ep &&
@@ -85,11 +85,11 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_endpoint_match);
* Return: A pointer to endpoint matching the criteria, %NULL if not found or
* an ERR_PTR() otherwise.
*/
-struct acpi_nhlt2_endpoint *
-acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt2 *tb,
+struct acpi_nhlt_endpoint *
+acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id)
{
- struct acpi_nhlt2_endpoint *ep;
+ struct acpi_nhlt_endpoint *ep;

for_each_nhlt_endpoint(tb, ep)
if (acpi_nhlt_endpoint_match(ep, link_type, dev_type, dir, bus_id))
@@ -111,7 +111,7 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_tb_find_endpoint);
* Return: A pointer to endpoint matching the criteria, %NULL if not found or
* an ERR_PTR() otherwise.
*/
-struct acpi_nhlt2_endpoint *
+struct acpi_nhlt_endpoint *
acpi_nhlt_find_endpoint(int link_type, int dev_type, int dir, int bus_id)
{
/* TODO: Currently limited to table of index 0. */
@@ -131,12 +131,12 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_find_endpoint);
* Return: A pointer to format matching the criteria, %NULL if not found or
* an ERR_PTR() otherwise.
*/
-struct acpi_nhlt2_format_config *
-acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt2_endpoint *ep,
+struct acpi_nhlt_format_config *
+acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt_endpoint *ep,
u16 ch, u32 rate, u16 vbps, u16 bps)
{
- struct acpi_nhlt2_wave_formatext *wav;
- struct acpi_nhlt2_format_config *fmt;
+ struct acpi_nhlt_wave_formatext *wav;
+ struct acpi_nhlt_format_config *fmt;

for_each_nhlt_endpoint_fmtcfg(ep, fmt) {
wav = &fmt->format;
@@ -171,13 +171,13 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_endpoint_find_fmtcfg);
* Return: A pointer to format matching the criteria, %NULL if not found or
* an ERR_PTR() otherwise.
*/
-struct acpi_nhlt2_format_config *
-acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt2 *tb,
+struct acpi_nhlt_format_config *
+acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vbps, u16 bps)
{
- struct acpi_nhlt2_format_config *fmt;
- struct acpi_nhlt2_endpoint *ep;
+ struct acpi_nhlt_format_config *fmt;
+ struct acpi_nhlt_endpoint *ep;

for_each_nhlt_endpoint(tb, ep) {
if (!acpi_nhlt_endpoint_match(ep, link_type, dev_type, dir, bus_id))
@@ -210,7 +210,7 @@ EXPORT_SYMBOL_GPL(acpi_nhlt_tb_find_fmtcfg);
* Return: A pointer to format matching the criteria, %NULL if not found or
* an ERR_PTR() otherwise.
*/
-struct acpi_nhlt2_format_config *
+struct acpi_nhlt_format_config *
acpi_nhlt_find_fmtcfg(int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vbps, u16 bps)
{
@@ -239,10 +239,10 @@ static bool acpi_nhlt_config_is_vendor_micdevice(struct acpi_nhlt_config *cfg)
*
* Return: A number of microphones or an error code if an invalid endpoint is provided.
*/
-int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt2_endpoint *ep)
+int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt_endpoint *ep)
{
union acpi_nhlt_device_config *devcfg;
- struct acpi_nhlt2_format_config *fmt;
+ struct acpi_nhlt_format_config *fmt;
struct acpi_nhlt_config *cfg;
u16 max_ch = 0;

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 31a716a74340..f237269bd1cb 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1894,7 +1894,7 @@ struct nfit_device_handle {
*
******************************************************************************/

-struct acpi_table_nhlt2 {
+struct acpi_table_nhlt {
struct acpi_table_header header; /* Common ACPI table header */
u8 endpoints_count;
/*
@@ -1903,7 +1903,7 @@ struct acpi_table_nhlt2 {
*/
};

-struct acpi_nhlt2_endpoint {
+struct acpi_nhlt_endpoint {
u32 length;
u8 link_type;
u8 instance_id;
@@ -1990,7 +1990,7 @@ struct acpi_nhlt_micdevice_config {
#define ACPI_NHLT_ARRAYTYPE_LINEAR4_GEO2 0xE
#define ACPI_NHLT_ARRAYTYPE_VENDOR 0xF

-struct acpi_nhlt2_vendor_mic_config {
+struct acpi_nhlt_vendor_mic_config {
u8 type;
u8 panel;
u16 speaker_position_distance; /* mm */
@@ -2031,7 +2031,7 @@ struct acpi_nhlt_vendor_micdevice_config {
u8 config_type;
u8 array_type;
u8 mics_count;
- struct acpi_nhlt2_vendor_mic_config mics[];
+ struct acpi_nhlt_vendor_mic_config mics[];
};

union acpi_nhlt_device_config {
@@ -2042,7 +2042,7 @@ union acpi_nhlt_device_config {
};

/* Inherited from Microsoft's WAVEFORMATEXTENSIBLE. */
-struct acpi_nhlt2_wave_formatext {
+struct acpi_nhlt_wave_formatext {
u16 format_tag;
u16 channel_count;
u32 samples_per_sec;
@@ -2055,17 +2055,17 @@ struct acpi_nhlt2_wave_formatext {
u8 subformat[16];
};

-struct acpi_nhlt2_format_config {
- struct acpi_nhlt2_wave_formatext format;
+struct acpi_nhlt_format_config {
+ struct acpi_nhlt_wave_formatext format;
struct acpi_nhlt_config config;
};

-struct acpi_nhlt2_formats_config {
+struct acpi_nhlt_formats_config {
u8 formats_count;
- struct acpi_nhlt2_format_config formats[];
+ struct acpi_nhlt_format_config formats[];
};

-struct acpi_nhlt2_device_info {
+struct acpi_nhlt_device_info {
u8 id[16];
u8 instance_id;
u8 port_id;
@@ -2073,7 +2073,7 @@ struct acpi_nhlt2_device_info {

struct acpi_nhlt_devices_info {
u8 devices_count;
- struct acpi_nhlt2_device_info devices[];
+ struct acpi_nhlt_device_info devices[];
};

/*******************************************************************************
diff --git a/include/acpi/nhlt.h b/include/acpi/nhlt.h
index 02c764e599fe..90cb09cd0bce 100644
--- a/include/acpi/nhlt.h
+++ b/include/acpi/nhlt.h
@@ -22,12 +22,12 @@
*
* Return: A pointer to the formats configuration space.
*/
-static inline struct acpi_nhlt2_formats_config *
-acpi_nhlt_endpoint_fmtscfg(const struct acpi_nhlt2_endpoint *ep)
+static inline struct acpi_nhlt_formats_config *
+acpi_nhlt_endpoint_fmtscfg(const struct acpi_nhlt_endpoint *ep)
{
struct acpi_nhlt_config *cfg = __acpi_nhlt_endpoint_config(ep);

- return (struct acpi_nhlt2_formats_config *)((u8 *)(cfg + 1) + cfg->capabilities_size);
+ return (struct acpi_nhlt_formats_config *)((u8 *)(cfg + 1) + cfg->capabilities_size);
}

#define __acpi_nhlt_first_endpoint(tb) \
@@ -98,24 +98,24 @@ acpi_nhlt_endpoint_fmtscfg(const struct acpi_nhlt2_endpoint *ep)
acpi_status acpi_nhlt_get_gbl_table(void);
void acpi_nhlt_put_gbl_table(void);

-bool acpi_nhlt_endpoint_match(const struct acpi_nhlt2_endpoint *ep,
+bool acpi_nhlt_endpoint_match(const struct acpi_nhlt_endpoint *ep,
int link_type, int dev_type, int dir, int bus_id);
-struct acpi_nhlt2_endpoint *
-acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt2 *tb,
+struct acpi_nhlt_endpoint *
+acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id);
-struct acpi_nhlt2_endpoint *
+struct acpi_nhlt_endpoint *
acpi_nhlt_find_endpoint(int link_type, int dev_type, int dir, int bus_id);
-struct acpi_nhlt2_format_config *
-acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt2_endpoint *ep,
+struct acpi_nhlt_format_config *
+acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt_endpoint *ep,
u16 ch, u32 rate, u16 vbps, u16 bps);
-struct acpi_nhlt2_format_config *
-acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt2 *tb,
+struct acpi_nhlt_format_config *
+acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vpbs, u16 bps);
-struct acpi_nhlt2_format_config *
+struct acpi_nhlt_format_config *
acpi_nhlt_find_fmtcfg(int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vpbs, u16 bps);
-int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt2_endpoint *ep);
+int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt_endpoint *ep);

#else /* !CONFIG_ACPI_NHLT */

@@ -129,46 +129,46 @@ static inline void acpi_nhlt_put_gbl_table(void)
}

static inline bool
-acpi_nhlt_endpoint_match(const struct acpi_nhlt2_endpoint *ep,
+acpi_nhlt_endpoint_match(const struct acpi_nhlt_endpoint *ep,
int link_type, int dev_type, int dir, int bus_id)
{
return false;
}

-static inline struct acpi_nhlt2_endpoint *
-acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt2 *tb,
+static inline struct acpi_nhlt_endpoint *
+acpi_nhlt_tb_find_endpoint(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id)
{
return NULL;
}

-static inline struct acpi_nhlt2_format_config *
-acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt2_endpoint *ep,
+static inline struct acpi_nhlt_format_config *
+acpi_nhlt_endpoint_find_fmtcfg(const struct acpi_nhlt_endpoint *ep,
u16 ch, u32 rate, u16 vbps, u16 bps)
{
return NULL;
}

-static inline struct acpi_nhlt2_format_config *
-acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt2 *tb,
+static inline struct acpi_nhlt_format_config *
+acpi_nhlt_tb_find_fmtcfg(const struct acpi_table_nhlt *tb,
int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vpbs, u16 bps)
{
return NULL;
}

-static inline int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt2_endpoint *ep)
+static inline int acpi_nhlt_endpoint_mic_count(const struct acpi_nhlt_endpoint *ep)
{
return 0;
}

-static inline struct acpi_nhlt2_endpoint *
+static inline struct acpi_nhlt_endpoint *
acpi_nhlt_find_endpoint(int link_type, int dev_type, int dir, int bus_id)
{
return NULL;
}

-static inline struct acpi_nhlt2_format_config *
+static inline struct acpi_nhlt_format_config *
acpi_nhlt_find_fmtcfg(int link_type, int dev_type, int dir, int bus_id,
u16 ch, u32 rate, u16 vpbs, u16 bps)
{
--
2.25.1