Commit bf8b24f8 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: x86: Drop the global platform device reference

Instead of referring to the global hlpe_pdev variable, pass the
platform device object to each function properly.  Accessing to the
global object is really ugly and error-prone.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent af3e5c9c
......@@ -172,11 +172,12 @@ int had_get_hwstate(struct snd_intelhad *intelhaddata)
int had_get_caps(struct snd_intelhad *intelhaddata,
enum had_caps_list query, void *caps)
{
struct platform_device *pdev = to_platform_device(intelhaddata->dev);
int retval;
retval = had_get_hwstate(intelhaddata);
if (!retval)
retval = mid_hdmi_audio_get_caps(query, caps);
retval = mid_hdmi_audio_get_caps(pdev, query, caps);
return retval;
}
......@@ -184,33 +185,36 @@ int had_get_caps(struct snd_intelhad *intelhaddata,
int had_set_caps(struct snd_intelhad *intelhaddata,
enum had_caps_list set_element, void *caps)
{
struct platform_device *pdev = to_platform_device(intelhaddata->dev);
int retval;
retval = had_get_hwstate(intelhaddata);
if (!retval)
retval = mid_hdmi_audio_set_caps(set_element, caps);
retval = mid_hdmi_audio_set_caps(pdev, set_element, caps);
return retval;
}
int had_read_register(struct snd_intelhad *intelhaddata, u32 offset, u32 *data)
{
struct platform_device *pdev = to_platform_device(intelhaddata->dev);
int retval;
retval = had_get_hwstate(intelhaddata);
if (!retval)
retval = mid_hdmi_audio_read(offset, data);
retval = mid_hdmi_audio_read(pdev, offset, data);
return retval;
}
int had_write_register(struct snd_intelhad *intelhaddata, u32 offset, u32 data)
{
struct platform_device *pdev = to_platform_device(intelhaddata->dev);
int retval;
retval = had_get_hwstate(intelhaddata);
if (!retval)
retval = mid_hdmi_audio_write(offset, data);
retval = mid_hdmi_audio_write(pdev, offset, data);
return retval;
}
......@@ -218,11 +222,12 @@ int had_write_register(struct snd_intelhad *intelhaddata, u32 offset, u32 data)
int had_read_modify(struct snd_intelhad *intelhaddata, u32 offset,
u32 data, u32 mask)
{
struct platform_device *pdev = to_platform_device(intelhaddata->dev);
int retval;
retval = had_get_hwstate(intelhaddata);
if (!retval)
retval = mid_hdmi_audio_rmw(offset, data, mask);
retval = mid_hdmi_audio_rmw(pdev, offset, data, mask);
return retval;
}
......
This diff is collapsed.
......@@ -31,6 +31,8 @@
#include <sound/control.h>
#include <sound/pcm.h>
struct platform_device;
#define AUD_CONFIG_VALID_BIT (1<<9)
#define AUD_CONFIG_DP_MODE (1<<15)
#define AUD_CONFIG_BLOCK_BIT (1<<7)
......@@ -642,15 +644,16 @@ struct hdmi_audio_event {
int type;
};
void mid_hdmi_audio_signal_event(enum had_event_type event);
int mid_hdmi_audio_read(u32 reg, u32 *val);
int mid_hdmi_audio_write(u32 reg, u32 val);
int mid_hdmi_audio_rmw(u32 reg, u32 val, u32 mask);
int mid_hdmi_audio_read(struct platform_device *pdev, u32 reg, u32 *val);
int mid_hdmi_audio_write(struct platform_device *pdev, u32 reg, u32 val);
int mid_hdmi_audio_rmw(struct platform_device *pdev,
u32 reg, u32 val, u32 mask);
int mid_hdmi_audio_get_caps(enum had_caps_list get_element,
int mid_hdmi_audio_get_caps(struct platform_device *pdev,
enum had_caps_list get_element,
void *capabilities);
int mid_hdmi_audio_set_caps(enum had_caps_list set_element,
int mid_hdmi_audio_set_caps(struct platform_device *pdev,
enum had_caps_list set_element,
void *capabilties);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment