Commit 1c8470ce authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

ALSA: snd-usb-caiaq: rename 'dev' to 'cdev'

This is needed in order to make the device namespace cleaner, and will
help when moving this driver over to dev_*() logging.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6dbe51c2
This diff is collapsed.
#ifndef CAIAQ_AUDIO_H #ifndef CAIAQ_AUDIO_H
#define CAIAQ_AUDIO_H #define CAIAQ_AUDIO_H
int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev); int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev);
void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev); void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *cdev);
#endif /* CAIAQ_AUDIO_H */ #endif /* CAIAQ_AUDIO_H */
...@@ -32,7 +32,7 @@ static int control_info(struct snd_kcontrol *kcontrol, ...@@ -32,7 +32,7 @@ static int control_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
int pos = kcontrol->private_value; int pos = kcontrol->private_value;
int is_intval = pos & CNT_INTVAL; int is_intval = pos & CNT_INTVAL;
int maxval = 63; int maxval = 63;
...@@ -40,7 +40,7 @@ static int control_info(struct snd_kcontrol *kcontrol, ...@@ -40,7 +40,7 @@ static int control_info(struct snd_kcontrol *kcontrol,
uinfo->count = 1; uinfo->count = 1;
pos &= ~CNT_INTVAL; pos &= ~CNT_INTVAL;
switch (dev->chip.usb_id) { switch (cdev->chip.usb_id) {
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
if (pos == 0) { if (pos == 0) {
...@@ -78,15 +78,15 @@ static int control_get(struct snd_kcontrol *kcontrol, ...@@ -78,15 +78,15 @@ static int control_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
int pos = kcontrol->private_value; int pos = kcontrol->private_value;
if (pos & CNT_INTVAL) if (pos & CNT_INTVAL)
ucontrol->value.integer.value[0] ucontrol->value.integer.value[0]
= dev->control_state[pos & ~CNT_INTVAL]; = cdev->control_state[pos & ~CNT_INTVAL];
else else
ucontrol->value.integer.value[0] ucontrol->value.integer.value[0]
= !!(dev->control_state[pos / 8] & (1 << pos % 8)); = !!(cdev->control_state[pos / 8] & (1 << pos % 8));
return 0; return 0;
} }
...@@ -95,43 +95,43 @@ static int control_put(struct snd_kcontrol *kcontrol, ...@@ -95,43 +95,43 @@ static int control_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
int pos = kcontrol->private_value; int pos = kcontrol->private_value;
int v = ucontrol->value.integer.value[0]; int v = ucontrol->value.integer.value[0];
unsigned char cmd = EP1_CMD_WRITE_IO; unsigned char cmd = EP1_CMD_WRITE_IO;
if (dev->chip.usb_id == if (cdev->chip.usb_id ==
USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1))
cmd = EP1_CMD_DIMM_LEDS; cmd = EP1_CMD_DIMM_LEDS;
if (pos & CNT_INTVAL) { if (pos & CNT_INTVAL) {
int i = pos & ~CNT_INTVAL; int i = pos & ~CNT_INTVAL;
dev->control_state[i] = v; cdev->control_state[i] = v;
if (dev->chip.usb_id == if (cdev->chip.usb_id ==
USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) { USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) {
int actual_len; int actual_len;
dev->ep8_out_buf[0] = i; cdev->ep8_out_buf[0] = i;
dev->ep8_out_buf[1] = v; cdev->ep8_out_buf[1] = v;
usb_bulk_msg(dev->chip.dev, usb_bulk_msg(cdev->chip.dev,
usb_sndbulkpipe(dev->chip.dev, 8), usb_sndbulkpipe(cdev->chip.dev, 8),
dev->ep8_out_buf, sizeof(dev->ep8_out_buf), cdev->ep8_out_buf, sizeof(cdev->ep8_out_buf),
&actual_len, 200); &actual_len, 200);
} else { } else {
snd_usb_caiaq_send_command(dev, cmd, snd_usb_caiaq_send_command(cdev, cmd,
dev->control_state, sizeof(dev->control_state)); cdev->control_state, sizeof(cdev->control_state));
} }
} else { } else {
if (v) if (v)
dev->control_state[pos / 8] |= 1 << (pos % 8); cdev->control_state[pos / 8] |= 1 << (pos % 8);
else else
dev->control_state[pos / 8] &= ~(1 << (pos % 8)); cdev->control_state[pos / 8] &= ~(1 << (pos % 8));
snd_usb_caiaq_send_command(dev, cmd, snd_usb_caiaq_send_command(cdev, cmd,
dev->control_state, sizeof(dev->control_state)); cdev->control_state, sizeof(cdev->control_state));
} }
return 1; return 1;
...@@ -490,7 +490,7 @@ static struct caiaq_controller kontrols4_controller[] = { ...@@ -490,7 +490,7 @@ static struct caiaq_controller kontrols4_controller[] = {
}; };
static int add_controls(struct caiaq_controller *c, int num, static int add_controls(struct caiaq_controller *c, int num,
struct snd_usb_caiaqdev *dev) struct snd_usb_caiaqdev *cdev)
{ {
int i, ret; int i, ret;
struct snd_kcontrol *kc; struct snd_kcontrol *kc;
...@@ -498,8 +498,8 @@ static int add_controls(struct caiaq_controller *c, int num, ...@@ -498,8 +498,8 @@ static int add_controls(struct caiaq_controller *c, int num,
for (i = 0; i < num; i++, c++) { for (i = 0; i < num; i++, c++) {
kcontrol_template.name = c->name; kcontrol_template.name = c->name;
kcontrol_template.private_value = c->index; kcontrol_template.private_value = c->index;
kc = snd_ctl_new1(&kcontrol_template, dev); kc = snd_ctl_new1(&kcontrol_template, cdev);
ret = snd_ctl_add(dev->chip.card, kc); ret = snd_ctl_add(cdev->chip.card, kc);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -507,50 +507,50 @@ static int add_controls(struct caiaq_controller *c, int num, ...@@ -507,50 +507,50 @@ static int add_controls(struct caiaq_controller *c, int num,
return 0; return 0;
} }
int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev)
{ {
int ret = 0; int ret = 0;
switch (dev->chip.usb_id) { switch (cdev->chip.usb_id) {
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
ret = add_controls(ak1_controller, ret = add_controls(ak1_controller,
ARRAY_SIZE(ak1_controller), dev); ARRAY_SIZE(ak1_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2):
ret = add_controls(rk2_controller, ret = add_controls(rk2_controller,
ARRAY_SIZE(rk2_controller), dev); ARRAY_SIZE(rk2_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
ret = add_controls(rk3_controller, ret = add_controls(rk3_controller,
ARRAY_SIZE(rk3_controller), dev); ARRAY_SIZE(rk3_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
ret = add_controls(kore_controller, ret = add_controls(kore_controller,
ARRAY_SIZE(kore_controller), dev); ARRAY_SIZE(kore_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
ret = add_controls(a8dj_controller, ret = add_controls(a8dj_controller,
ARRAY_SIZE(a8dj_controller), dev); ARRAY_SIZE(a8dj_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
ret = add_controls(a4dj_controller, ret = add_controls(a4dj_controller,
ARRAY_SIZE(a4dj_controller), dev); ARRAY_SIZE(a4dj_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
ret = add_controls(kontrolx1_controller, ret = add_controls(kontrolx1_controller,
ARRAY_SIZE(kontrolx1_controller), dev); ARRAY_SIZE(kontrolx1_controller), cdev);
break; break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4):
ret = add_controls(kontrols4_controller, ret = add_controls(kontrols4_controller,
ARRAY_SIZE(kontrols4_controller), dev); ARRAY_SIZE(kontrols4_controller), cdev);
break; break;
} }
......
#ifndef CAIAQ_CONTROL_H #ifndef CAIAQ_CONTROL_H
#define CAIAQ_CONTROL_H #define CAIAQ_CONTROL_H
int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev); int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev);
#endif /* CAIAQ_CONTROL_H */ #endif /* CAIAQ_CONTROL_H */
This diff is collapsed.
...@@ -124,15 +124,15 @@ struct snd_usb_caiaqdev { ...@@ -124,15 +124,15 @@ struct snd_usb_caiaqdev {
}; };
struct snd_usb_caiaq_cb_info { struct snd_usb_caiaq_cb_info {
struct snd_usb_caiaqdev *dev; struct snd_usb_caiaqdev *cdev;
int index; int index;
}; };
#define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data)
int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp); int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, int rate, int depth, int bbp);
int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp); int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *cdev, int digital, int analog, int erp);
int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev,
unsigned char command, unsigned char command,
const unsigned char *buffer, const unsigned char *buffer,
int len); int len);
......
This diff is collapsed.
#ifndef CAIAQ_INPUT_H #ifndef CAIAQ_INPUT_H
#define CAIAQ_INPUT_H #define CAIAQ_INPUT_H
void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, char *buf, unsigned int len); void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *cdev, char *buf, unsigned int len);
int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev); int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev);
void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev); void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *cdev);
#endif #endif
...@@ -37,12 +37,12 @@ static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substrea ...@@ -37,12 +37,12 @@ static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substrea
static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
{ {
struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
if (!dev) if (!cdev)
return; return;
dev->midi_receive_substream = up ? substream : NULL; cdev->midi_receive_substream = up ? substream : NULL;
} }
...@@ -53,49 +53,49 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea ...@@ -53,49 +53,49 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea
static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream)
{ {
struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
if (dev->midi_out_active) { if (cdev->midi_out_active) {
usb_kill_urb(&dev->midi_out_urb); usb_kill_urb(&cdev->midi_out_urb);
dev->midi_out_active = 0; cdev->midi_out_active = 0;
} }
return 0; return 0;
} }
static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *cdev,
struct snd_rawmidi_substream *substream) struct snd_rawmidi_substream *substream)
{ {
int len, ret; int len, ret;
dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; cdev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE;
dev->midi_out_buf[1] = 0; /* port */ cdev->midi_out_buf[1] = 0; /* port */
len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, len = snd_rawmidi_transmit(substream, cdev->midi_out_buf + 3,
EP1_BUFSIZE - 3); EP1_BUFSIZE - 3);
if (len <= 0) if (len <= 0)
return; return;
dev->midi_out_buf[2] = len; cdev->midi_out_buf[2] = len;
dev->midi_out_urb.transfer_buffer_length = len+3; cdev->midi_out_urb.transfer_buffer_length = len+3;
ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); ret = usb_submit_urb(&cdev->midi_out_urb, GFP_ATOMIC);
if (ret < 0) if (ret < 0)
log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed,"
"ret=%d, len=%d\n", "ret=%d, len=%d\n",
substream, ret, len); substream, ret, len);
else else
dev->midi_out_active = 1; cdev->midi_out_active = 1;
} }
static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
{ {
struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data;
if (up) { if (up) {
dev->midi_out_substream = substream; cdev->midi_out_substream = substream;
if (!dev->midi_out_active) if (!cdev->midi_out_active)
snd_usb_caiaq_midi_send(dev, substream); snd_usb_caiaq_midi_send(cdev, substream);
} else { } else {
dev->midi_out_substream = NULL; cdev->midi_out_substream = NULL;
} }
} }
...@@ -114,13 +114,13 @@ static struct snd_rawmidi_ops snd_usb_caiaq_midi_input = ...@@ -114,13 +114,13 @@ static struct snd_rawmidi_ops snd_usb_caiaq_midi_input =
.trigger = snd_usb_caiaq_midi_input_trigger, .trigger = snd_usb_caiaq_midi_input_trigger,
}; };
void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *cdev,
int port, const char *buf, int len) int port, const char *buf, int len)
{ {
if (!dev->midi_receive_substream) if (!cdev->midi_receive_substream)
return; return;
snd_rawmidi_receive(dev->midi_receive_substream, buf, len); snd_rawmidi_receive(cdev->midi_receive_substream, buf, len);
} }
int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
...@@ -160,15 +160,15 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) ...@@ -160,15 +160,15 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
void snd_usb_caiaq_midi_output_done(struct urb* urb) void snd_usb_caiaq_midi_output_done(struct urb* urb)
{ {
struct snd_usb_caiaqdev *dev = urb->context; struct snd_usb_caiaqdev *cdev = urb->context;
dev->midi_out_active = 0; cdev->midi_out_active = 0;
if (urb->status != 0) if (urb->status != 0)
return; return;
if (!dev->midi_out_substream) if (!cdev->midi_out_substream)
return; return;
snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); snd_usb_caiaq_midi_send(cdev, cdev->midi_out_substream);
} }
#ifndef CAIAQ_MIDI_H #ifndef CAIAQ_MIDI_H
#define CAIAQ_MIDI_H #define CAIAQ_MIDI_H
int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *cdev);
void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *cdev,
int port, const char *buf, int len);
void snd_usb_caiaq_midi_output_done(struct urb *urb); void snd_usb_caiaq_midi_output_done(struct urb *urb);
#endif /* CAIAQ_MIDI_H */ #endif /* CAIAQ_MIDI_H */
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