[alsa-devel] [PATCH 1/2] fm801: introduce macros to access the hardware

Takashi Iwai tiwai at suse.de
Mon Apr 28 12:20:35 CEST 2014


At Mon, 28 Apr 2014 11:00:29 +0300,
Andy Shevchenko wrote:
> 
> It will help to maintain HW accessors and, for example, switch from the
> direct I/O to MMIO which is more convenient for PCI devices.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko at gmail.com>
> ---
>  sound/pci/fm801.c | 131 ++++++++++++++++++++++++++++--------------------------
>  1 file changed, 68 insertions(+), 63 deletions(-)
> 
> diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
> index db18cca..8418484 100644
> --- a/sound/pci/fm801.c
> +++ b/sound/pci/fm801.c
> @@ -23,6 +23,7 @@
>  #include <linux/delay.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
> +#include <linux/io.h>
>  #include <linux/pci.h>
>  #include <linux/slab.h>
>  #include <linux/module.h>
> @@ -34,8 +35,6 @@
>  #include <sound/opl3.h>
>  #include <sound/initval.h>
>  
> -#include <asm/io.h>
> -
>  #ifdef CONFIG_SND_FM801_TEA575X_BOOL
>  #include <media/tea575x.h>
>  #endif
> @@ -80,7 +79,10 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers");
>   *  Direct registers
>   */
>  
> -#define FM801_REG(chip, reg)	(chip->port + FM801_##reg)
> +#define fm801_writew(v,chip,reg)	outw((v), chip->port + FM801_##reg)
> +#define fm801_readw(chip,reg)		inw(chip->port + FM801_##reg)
> +
> +#define fm801_writel(v,chip,reg)	outl((v), chip->port + FM801_##reg)

IMO, it's better in a form like fm801_writel(chip, reg, value)


thanks,

Takashi


More information about the Alsa-devel mailing list