ALSA: ak411x: Use array instead of offsetof()

The ak4113, ak4114 and ak4117 i2c drivers have some tricky codes to
access the struct fields in the callback.  This can be simplified by
replacing the struct fields with the array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
这个提交包含在:
Takashi Iwai
2017-05-12 10:47:16 +02:00
父节点 2e0de6ea95
当前提交 239480ab92
修改 6 个文件,包含 60 行新增48 行删除

查看文件

@@ -155,6 +155,14 @@
typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data);
typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr);
enum {
AK4117_PARITY_ERRORS,
AK4117_V_BIT_ERRORS,
AK4117_QCRC_ERRORS,
AK4117_CCRC_ERRORS,
AK4117_NUM_ERRORS
};
struct ak4117 {
struct snd_card *card;
ak4117_write_t * write;
@@ -165,10 +173,7 @@ struct ak4117 {
unsigned char regmap[5];
struct snd_kcontrol *kctls[AK4117_CONTROLS];
struct snd_pcm_substream *substream;
unsigned long parity_errors;
unsigned long v_bit_errors;
unsigned long qcrc_errors;
unsigned long ccrc_errors;
unsigned long errors[AK4117_NUM_ERRORS];
unsigned char rcs0;
unsigned char rcs1;
unsigned char rcs2;