Skip to contentSkip to conversation

ALSA: hda - Make azx_attach_pcm_stream static

PATCH Applied Dylan Reid 2 participants 4 messages Mar 3, 2014 Sound

lore
Share & tools
lore

Dylan Reid

author
#0 lore raw

PATCH 1/3 ALSA: hda - Make azx_attach_pcm_stream static

It is only used in hda_controller.c now.

---
 sound/pci/hda/hda_controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_controller.c +2 -2
index 6156d0a..97993e1 100644
@@ -971,8 +971,8 @@ static void azx_pcm_free(struct snd_pcm *pcm)
 
 #define MAX_PREALLOC_SIZE	(32 * 1024 * 1024)
 
-int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
-			  struct hda_pcm *cpcm)
+static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
+				 struct hda_pcm *cpcm)
 {
 	struct azx *chip = bus->private_data;
 	struct snd_pcm *pcm;
Signature · 1 line
1.8.1.3.605.g02339dd
author
#1 lore raw

PATCH 2/3 ALSA: hda - Rename reg access ops in hda_controller_ops

Using readl, writel, etc. resulted in some architectures, such as s390, expanding the member names into zpci_writel. Obviously not the intended result.

Fixes s390 build breakage introduced by "4083081 - ALSA: hda - Allow different ops to read/write registers"

---
 sound/pci/hda/hda_intel.c | 12 ++++++------
 sound/pci/hda/hda_priv.h  | 36 ++++++++++++++++++------------------
 2 files changed, 24 insertions(+), 24 deletions(-)
sound/pci/hda/hda_intel.c +6 -6
index b26eff3..149c00b 100644
@@ -1537,12 +1537,12 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
 }
 
 static const struct hda_controller_ops pci_hda_ops = {
-	.writel = pci_azx_writel,
-	.readl = pci_azx_readl,
-	.writew = pci_azx_writew,
-	.readw = pci_azx_readw,
-	.writeb = pci_azx_writeb,
-	.readb = pci_azx_readb,
+	.reg_writel = pci_azx_writel,
+	.reg_readl = pci_azx_readl,
+	.reg_writew = pci_azx_writew,
+	.reg_readw = pci_azx_readw,
+	.reg_writeb = pci_azx_writeb,
+	.reg_readb = pci_azx_readb,
 	.disable_msi_reset_irq = disable_msi_reset_irq,
 	.dma_alloc_pages = dma_alloc_pages,
 	.dma_free_pages = dma_free_pages,
sound/pci/hda/hda_priv.h +18 -18
index bf3cb33..198fa82 100644
@@ -290,12 +290,12 @@ struct azx;
 /* Functions to read/write to hda registers. */
 struct hda_controller_ops {
 	/* Register Access */
-	void (*writel)(u32 value, u32 *addr);
-	u32 (*readl)(u32 *addr);
-	void (*writew)(u16 value, u16 *addr);
-	u16 (*readw)(u16 *addr);
-	void (*writeb)(u8 value, u8 *addr);
-	u8 (*readb)(u8 *addr);
+	void (*reg_writel)(u32 value, u32 *addr);
+	u32 (*reg_readl)(u32 *addr);
+	void (*reg_writew)(u16 value, u16 *addr);
+	u16 (*reg_readw)(u16 *addr);
+	void (*reg_writeb)(u8 value, u8 *addr);
+	u8 (*reg_readb)(u8 *addr);
 	/* Disable msi if supported, PCI only */
 	int (*disable_msi_reset_irq)(struct azx *);
 	/* Allocation ops */
@@ -435,29 +435,29 @@ struct azx {
  */
 
 #define azx_writel(chip, reg, value) \
-	((chip)->ops->writel(value, (chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writel(value, (chip)->remap_addr + ICH6_REG_##reg))
 #define azx_readl(chip, reg) \
-	((chip)->ops->readl((chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readl((chip)->remap_addr + ICH6_REG_##reg))
 #define azx_writew(chip, reg, value) \
-	((chip)->ops->writew(value, (chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writew(value, (chip)->remap_addr + ICH6_REG_##reg))
 #define azx_readw(chip, reg) \
-	((chip)->ops->readw((chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readw((chip)->remap_addr + ICH6_REG_##reg))
 #define azx_writeb(chip, reg, value) \
-	((chip)->ops->writeb(value, (chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writeb(value, (chip)->remap_addr + ICH6_REG_##reg))
 #define azx_readb(chip, reg) \
-	((chip)->ops->readb((chip)->remap_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readb((chip)->remap_addr + ICH6_REG_##reg))
 
 #define azx_sd_writel(chip, dev, reg, value) \
-	((chip)->ops->writel(value, (dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writel(value, (dev)->sd_addr + ICH6_REG_##reg))
 #define azx_sd_readl(chip, dev, reg) \
-	((chip)->ops->readl((dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readl((dev)->sd_addr + ICH6_REG_##reg))
 #define azx_sd_writew(chip, dev, reg, value) \
-	((chip)->ops->writew(value, (dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writew(value, (dev)->sd_addr + ICH6_REG_##reg))
 #define azx_sd_readw(chip, dev, reg) \
-	((chip)->ops->readw((dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readw((dev)->sd_addr + ICH6_REG_##reg))
 #define azx_sd_writeb(chip, dev, reg, value) \
-	((chip)->ops->writeb(value, (dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_writeb(value, (dev)->sd_addr + ICH6_REG_##reg))
 #define azx_sd_readb(chip, dev, reg) \
-	((chip)->ops->readb((dev)->sd_addr + ICH6_REG_##reg))
+	((chip)->ops->reg_readb((dev)->sd_addr + ICH6_REG_##reg))
 
 #endif /* __SOUND_HDA_PRIV_H */
Signature · 1 line
1.8.1.3.605.g02339dd
author
#2 lore raw

PATCH 3/3 ALSA: hda - Mark reg op args as iomem

In reply to Dylan Reid

The ops to read and write registers should take pointers labeled as __iomem. Thanks to the sparse bot for catching this.

---
 sound/pci/hda/hda_intel.c | 12 ++++++------
 sound/pci/hda/hda_priv.h  | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
sound/pci/hda/hda_intel.c +6 -6
index 149c00b..77ca894 100644
@@ -1431,32 +1431,32 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
  */
 
 /* PCI register access. */
-static void pci_azx_writel(u32 value, u32 *addr)
+static void pci_azx_writel(u32 value, u32 __iomem *addr)
 {
 	writel(value, addr);
 }
 
-static u32 pci_azx_readl(u32 *addr)
+static u32 pci_azx_readl(u32 __iomem *addr)
 {
 	return readl(addr);
 }
 
-static void pci_azx_writew(u16 value, u16 *addr)
+static void pci_azx_writew(u16 value, u16 __iomem *addr)
 {
 	writew(value, addr);
 }
 
-static u16 pci_azx_readw(u16 *addr)
+static u16 pci_azx_readw(u16 __iomem *addr)
 {
 	return readw(addr);
 }
 
-static void pci_azx_writeb(u8 value, u8 *addr)
+static void pci_azx_writeb(u8 value, u8 __iomem *addr)
 {
 	writeb(value, addr);
 }
 
-static u8 pci_azx_readb(u8 *addr)
+static u8 pci_azx_readb(u8 __iomem *addr)
 {
 	return readb(addr);
 }
sound/pci/hda/hda_priv.h +6 -6
index 198fa82..ba38b81 100644
@@ -290,12 +290,12 @@ struct azx;
 /* Functions to read/write to hda registers. */
 struct hda_controller_ops {
 	/* Register Access */
-	void (*reg_writel)(u32 value, u32 *addr);
-	u32 (*reg_readl)(u32 *addr);
-	void (*reg_writew)(u16 value, u16 *addr);
-	u16 (*reg_readw)(u16 *addr);
-	void (*reg_writeb)(u8 value, u8 *addr);
-	u8 (*reg_readb)(u8 *addr);
+	void (*reg_writel)(u32 value, u32 __iomem *addr);
+	u32 (*reg_readl)(u32 __iomem *addr);
+	void (*reg_writew)(u16 value, u16 __iomem *addr);
+	u16 (*reg_readw)(u16 __iomem *addr);
+	void (*reg_writeb)(u8 value, u8 __iomem *addr);
+	u8 (*reg_readb)(u8 __iomem *addr);
 	/* Disable msi if supported, PCI only */
 	int (*disable_msi_reset_irq)(struct azx *);
 	/* Allocation ops */
Signature · 1 line
1.8.1.3.605.g02339dd
Applied
#3 lore raw
In reply to Dylan Reid

At Sun, 2 Mar 2014 20:43:59 -0800,

Quoted 4 lines · Dylan Reid

It is only used in hda_controller.c now.

Thanks, applied all three patches.

Takashi

Quoted 22 lines
---
 sound/pci/hda/hda_controller.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_controller.c +2 -2
index 6156d0a..97993e1 100644
@@ -971,8 +971,8 @@ static void azx_pcm_free(struct snd_pcm *pcm)
 
 #define MAX_PREALLOC_SIZE	(32 * 1024 * 1024)
 
-int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
-			  struct hda_pcm *cpcm)
+static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
+				 struct hda_pcm *cpcm)
 {
 	struct azx *chip = bus->private_data;
 	struct snd_pcm *pcm;
Signature · 1 line
1.8.1.3.605.g02339dd