diff options
author | Simon Glass | 2018-12-03 04:37:30 -0700 |
---|---|---|
committer | Simon Glass | 2018-12-13 16:32:49 -0700 |
commit | 372922ca8f8ad851d6003f76fff9edd4c8cb172f (patch) | |
tree | f0dbe82454434be468ff8c2e3423aedd76bc618a | |
parent | 6ab0d25d55b104db45f0d4f88d74d6a5e234a476 (diff) |
dm: sound: max98095: Drop global i2c-address variable
We can put this in the private structure and avoid a global.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/sound/max98095.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c index 51556c07f5e..2ec67bf24a8 100644 --- a/drivers/sound/max98095.c +++ b/drivers/sound/max98095.c @@ -28,11 +28,11 @@ struct max98095_priv { unsigned int sysclk; unsigned int rate; unsigned int fmt; + int i2c_addr; }; static struct sound_codec_info g_codec_info; struct max98095_priv g_max98095_info; -unsigned int g_max98095_i2c_dev_addr; /* Index 0 is reserved. */ int rate_table[] = {0, 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, @@ -52,7 +52,7 @@ static int max98095_i2c_write(struct max98095_priv *priv, unsigned int reg, { debug("%s: Write Addr : 0x%02X, Data : 0x%02X\n", __func__, reg, data); - return i2c_write(g_max98095_i2c_dev_addr, reg, 1, &data, 1); + return i2c_write(priv->i2c_addr, reg, 1, &data, 1); } /* @@ -69,7 +69,7 @@ static unsigned int max98095_i2c_read(struct max98095_priv *priv, { int ret; - ret = i2c_read(g_max98095_i2c_dev_addr, reg, 1, data, 1); + ret = i2c_read(priv->i2c_addr, reg, 1, data, 1); if (ret != 0) { debug("%s: Error while reading register %#04x\n", __func__, reg); @@ -574,7 +574,7 @@ int max98095_init(const void *blob, enum en_max_audio_interface aif_id, i2c_set_bus_num(pcodec_info->i2c_bus); /* shift the device address by 1 for 7 bit addressing */ - g_max98095_i2c_dev_addr = pcodec_info->i2c_dev_addr >> 1; + g_max98095_info.i2c_addr = pcodec_info->i2c_dev_addr >> 1; ret = max98095_device_init(&g_max98095_info); if (ret < 0) { debug("%s: max98095 codec chip init failed\n", __func__); |