Skip to contentSkip to conversation

ALSA: hda: hda_component: Add missing #include guards

PATCH Applied Richard Fitzgerald 2 participants 3 messages Mar 7, 2024 – Mar 8, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ALSA: hda: hda_component: Add missing #include guards

Add the conventional include guards around the content of the hda_component.h header file. This prevents double-declaration of struct hda_component if the header gets included multiple times.

This isn't causing any problems with current code, so no need to backport to older kernels.

---
 sound/pci/hda/hda_component.h | 5 +++++
 1 file changed, 5 insertions(+)
sound/pci/hda/hda_component.h +5 -0
index deae9dea01b4..a0fcc723483d 100644
@@ -6,6 +6,9 @@
  *                    Cirrus Logic International Semiconductor Ltd.
  */
 
+#ifndef __HDA_COMPONENT_H__
+#define __HDA_COMPONENT_H__
+
 #include <linux/acpi.h>
 #include <linux/component.h>
 
@@ -82,3 +85,5 @@ static inline void hda_component_manager_unbind(struct hda_codec *cdc,
 {
 	component_unbind_all(hda_codec_dev(cdc), comps);
 }
+
+#endif /* ifndef __HDA_COMPONENT_H__ */
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 ALSA: hda: hda_component: Include sound/hda_codec.h

hda_component.h uses hda_codec_dev from sound/hda_codec.h. Include sound/hda_codec.h instead of assuming that it has already been included by the parent .c file.

This isn't causing any problems with current code, so no need to backport to older kernels.

---
 sound/pci/hda/hda_component.h | 1 +
 1 file changed, 1 insertion(+)
sound/pci/hda/hda_component.h +1 -0
index a0fcc723483d..c80a66691b5d 100644
@@ -11,6 +11,7 @@
 
 #include <linux/acpi.h>
 #include <linux/component.h>
+#include <sound/hda_codec.h>
 
 #define HDA_MAX_COMPONENTS	4
 #define HDA_MAX_NAME_SIZE	50
Signature · 1 line
2.30.2
Applied
#2 lore raw
In reply to Richard Fitzgerald
Quoted 9 lines · Richard Fitzgerald

Add the conventional include guards around the content of the hda_component.h header file. This prevents double-declaration of struct hda_component if the header gets included multiple times.

This isn't causing any problems with current code, so no need to backport to older kernels.

Applied both patches now. Thanks.

Takashi