Commit bae3ce49 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usx2y: Avoid camelCase

For improving readability, convert camelCase fields, variables and
functions to the plain names with underscore.  Also align the macros
to be capital letters.

All done via sed, no functional changes.

Note that you'll still see many coding style issues even after this
patch; the fixes will follow.

Link: https://lore.kernel.org/r/20210517131545.27252-2-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 08fdced6
......@@ -29,7 +29,7 @@ static vm_fault_t snd_us428ctls_vm_fault(struct vm_fault *vmf)
vmf->pgoff);
offset = vmf->pgoff << PAGE_SHIFT;
vaddr = (char *)((struct usX2Ydev *)vmf->vma->vm_private_data)->us428ctls_sharedmem + offset;
vaddr = (char *)((struct usx2ydev *)vmf->vma->vm_private_data)->us428ctls_sharedmem + offset;
page = virt_to_page(vaddr);
get_page(page);
vmf->page = page;
......@@ -47,7 +47,7 @@ static const struct vm_operations_struct us428ctls_vm_ops = {
static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area)
{
unsigned long size = (unsigned long)(area->vm_end - area->vm_start);
struct usX2Ydev *us428 = hw->private_data;
struct usx2ydev *us428 = hw->private_data;
// FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs?
// so as long as the device isn't fully initialised yet we return -EBUSY here.
......@@ -66,7 +66,7 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
if (!us428->us428ctls_sharedmem)
return -ENOMEM;
memset(us428->us428ctls_sharedmem, -1, sizeof(struct us428ctls_sharedmem));
us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
us428->us428ctls_sharedmem->ctl_snapshot_last = -2;
}
area->vm_ops = &us428ctls_vm_ops;
area->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
......@@ -77,21 +77,21 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
static __poll_t snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait)
{
__poll_t mask = 0;
struct usX2Ydev *us428 = hw->private_data;
struct usx2ydev *us428 = hw->private_data;
struct us428ctls_sharedmem *shm = us428->us428ctls_sharedmem;
if (us428->chip_status & USX2Y_STAT_CHIP_HUP)
return EPOLLHUP;
poll_wait(file, &us428->us428ctls_wait_queue_head, wait);
if (shm != NULL && shm->CtlSnapShotLast != shm->CtlSnapShotRed)
if (shm != NULL && shm->ctl_snapshot_last != shm->ctl_snapshot_red)
mask |= EPOLLIN;
return mask;
}
static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
static int snd_usx2y_hwdep_dsp_status(struct snd_hwdep *hw,
struct snd_hwdep_dsp_status *info)
{
static const char * const type_ids[USX2Y_TYPE_NUMS] = {
......@@ -99,7 +99,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
[USX2Y_TYPE_224] = "us224",
[USX2Y_TYPE_428] = "us428",
};
struct usX2Ydev *us428 = hw->private_data;
struct usx2ydev *us428 = hw->private_data;
int id = -1;
switch (le16_to_cpu(us428->dev->descriptor.idProduct)) {
......@@ -124,7 +124,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
}
static int usX2Y_create_usbmidi(struct snd_card *card)
static int usx2y_create_usbmidi(struct snd_card *card)
{
static const struct snd_usb_midi_endpoint_info quirk_data_1 = {
.out_ep = 0x06,
......@@ -152,28 +152,28 @@ static int usX2Y_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &quirk_data_2
};
struct usb_device *dev = usX2Y(card)->dev;
struct usb_device *dev = usx2y(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
const struct snd_usb_audio_quirk *quirk =
le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ?
&quirk_2 : &quirk_1;
snd_printdd("usX2Y_create_usbmidi \n");
return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
snd_printdd("usx2y_create_usbmidi \n");
return snd_usbmidi_create(card, iface, &usx2y(card)->midi_list, quirk);
}
static int usX2Y_create_alsa_devices(struct snd_card *card)
static int usx2y_create_alsa_devices(struct snd_card *card)
{
int err;
do {
if ((err = usX2Y_create_usbmidi(card)) < 0) {
snd_printk(KERN_ERR "usX2Y_create_alsa_devices: usX2Y_create_usbmidi error %i \n", err);
if ((err = usx2y_create_usbmidi(card)) < 0) {
snd_printk(KERN_ERR "usx2y_create_alsa_devices: usx2y_create_usbmidi error %i \n", err);
break;
}
if ((err = usX2Y_audio_create(card)) < 0)
if ((err = usx2y_audio_create(card)) < 0)
break;
if ((err = usX2Y_hwdep_pcm_new(card)) < 0)
if ((err = usx2y_hwdep_pcm_new(card)) < 0)
break;
if ((err = snd_card_register(card)) < 0)
break;
......@@ -182,10 +182,10 @@ static int usX2Y_create_alsa_devices(struct snd_card *card)
return err;
}
static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw,
struct snd_hwdep_dsp_image *dsp)
{
struct usX2Ydev *priv = hw->private_data;
struct usx2ydev *priv = hw->private_data;
struct usb_device* dev = priv->dev;
int lret, err;
char *buf;
......@@ -206,19 +206,19 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
return err;
if (dsp->index == 1) {
msleep(250); // give the device some time
err = usX2Y_AsyncSeq04_init(priv);
err = usx2y_async_seq04_init(priv);
if (err) {
snd_printk(KERN_ERR "usX2Y_AsyncSeq04_init error \n");
snd_printk(KERN_ERR "usx2y_async_seq04_init error \n");
return err;
}
err = usX2Y_In04_init(priv);
err = usx2y_in04_init(priv);
if (err) {
snd_printk(KERN_ERR "usX2Y_In04_init error \n");
snd_printk(KERN_ERR "usx2y_in04_init error \n");
return err;
}
err = usX2Y_create_alsa_devices(hw->card);
err = usx2y_create_alsa_devices(hw->card);
if (err) {
snd_printk(KERN_ERR "usX2Y_create_alsa_devices error %i \n", err);
snd_printk(KERN_ERR "usx2y_create_alsa_devices error %i \n", err);
snd_card_free(hw->card);
return err;
}
......@@ -229,7 +229,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
}
int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device)
int usx2y_hwdep_new(struct snd_card *card, struct usb_device* device)
{
int err;
struct snd_hwdep *hw;
......@@ -238,9 +238,9 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device)
return err;
hw->iface = SNDRV_HWDEP_IFACE_USX2Y;
hw->private_data = usX2Y(card);
hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status;
hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load;
hw->private_data = usx2y(card);
hw->ops.dsp_status = snd_usx2y_hwdep_dsp_status;
hw->ops.dsp_load = snd_usx2y_hwdep_dsp_load;
hw->ops.mmap = snd_us428ctls_mmap;
hw->ops.poll = snd_us428ctls_poll;
hw->exclusive = 1;
......
......@@ -2,6 +2,6 @@
#ifndef USX2YHWDEP_H
#define USX2YHWDEP_H
int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device);
int usx2y_hwdep_new(struct snd_card *card, struct usb_device* device);
#endif
......@@ -4,28 +4,28 @@
* Copyright (c) 2003 by Karsten Wiese <annabellesgarden@yahoo.de>
*/
enum E_In84{
eFader0 = 0,
eFader1,
eFader2,
eFader3,
eFader4,
eFader5,
eFader6,
eFader7,
eFaderM,
eTransport,
eModifier = 10,
eFilterSelect,
eSelect,
eMute,
enum E_IN84 {
E_FADER_0 = 0,
E_FADER_1,
E_FADER_2,
E_FADER_3,
E_FADER_4,
E_FADER_5,
E_FADER_6,
E_FADER_7,
E_FADER_M,
E_TRANSPORT,
E_MODIFIER = 10,
E_FILTER_SELECT,
E_SELECT,
E_MUTE,
eSwitch = 15,
eWheelGain,
eWheelFreq,
eWheelQ,
eWheelPan,
eWheel = 20
E_SWITCH = 15,
E_WHEEL_GAIN,
E_WHEEL_FREQ,
E_WHEEL_Q,
E_WHEEL_PAN,
E_WHEEL = 20
};
#define T_RECORD 1
......@@ -39,53 +39,53 @@ enum E_In84{
struct us428_ctls {
unsigned char Fader[9];
unsigned char Transport;
unsigned char Modifier;
unsigned char FilterSelect;
unsigned char Select;
unsigned char Mute;
unsigned char UNKNOWN;
unsigned char Switch;
unsigned char Wheel[5];
unsigned char fader[9];
unsigned char transport;
unsigned char modifier;
unsigned char filters_elect;
unsigned char select;
unsigned char mute;
unsigned char unknown;
unsigned char wswitch;
unsigned char wheel[5];
};
struct us428_setByte {
unsigned char Offset,
Value;
struct us428_set_byte {
unsigned char offset,
value;
};
enum {
eLT_Volume = 0,
eLT_Light
ELT_VOLUME = 0,
ELT_LIGHT
};
struct usX2Y_volume {
unsigned char Channel,
LH,
LL,
RH,
RL;
struct usx2y_volume {
unsigned char channel,
lh,
ll,
rh,
rl;
};
struct us428_lights {
struct us428_setByte Light[7];
struct us428_set_byte light[7];
};
struct us428_p4out {
char type;
union {
struct usX2Y_volume vol;
struct usx2y_volume vol;
struct us428_lights lights;
} val;
};
#define N_us428_ctl_BUFS 16
#define N_us428_p4out_BUFS 16
struct us428ctls_sharedmem{
struct us428_ctls CtlSnapShot[N_us428_ctl_BUFS];
int CtlSnapShotDiffersAt[N_us428_ctl_BUFS];
int CtlSnapShotLast, CtlSnapShotRed;
struct us428_p4out p4out[N_us428_p4out_BUFS];
int p4outLast, p4outSent;
#define N_US428_CTL_BUFS 16
#define N_US428_P4OUT_BUFS 16
struct us428ctls_sharedmem {
struct us428_ctls ctl_snapshot[N_US428_CTL_BUFS];
int ctl_snapshot_differs_at[N_US428_CTL_BUFS];
int ctl_snapshot_last, ctl_snapshot_red;
struct us428_p4out p4out[N_US428_P4OUT_BUFS];
int p4out_last, p4out_sent;
};
This diff is collapsed.
......@@ -8,14 +8,14 @@
#define NRURBS 2
#define URBS_AsyncSeq 10
#define URB_DataLen_AsyncSeq 32
struct snd_usX2Y_AsyncSeq {
struct urb *urb[URBS_AsyncSeq];
#define URBS_ASYNC_SEQ 10
#define URB_DATA_LEN_ASYNC_SEQ 32
struct snd_usx2y_async_seq {
struct urb *urb[URBS_ASYNC_SEQ];
char *buffer;
};
struct snd_usX2Y_urbSeq {
struct snd_usx2y_urb_seq {
int submitted;
int len;
struct urb *urb[];
......@@ -23,17 +23,17 @@ struct snd_usX2Y_urbSeq {
#include "usx2yhwdeppcm.h"
struct usX2Ydev {
struct usx2ydev {
struct usb_device *dev;
int card_index;
int stride;
struct urb *In04urb;
void *In04Buf;
char In04Last[24];
unsigned In04IntCalls;
struct snd_usX2Y_urbSeq *US04;
wait_queue_head_t In04WaitQueue;
struct snd_usX2Y_AsyncSeq AS04;
struct urb *in04_urb;
void *in04_buf;
char in04_last[24];
unsigned in04_int_calls;
struct snd_usx2y_urb_seq *us04;
wait_queue_head_t in04_wait_queue;
struct snd_usx2y_async_seq as04;
unsigned int rate,
format;
int chip_status;
......@@ -41,9 +41,9 @@ struct usX2Ydev {
struct us428ctls_sharedmem *us428ctls_sharedmem;
int wait_iso_frame;
wait_queue_head_t us428ctls_wait_queue_head;
struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
struct snd_usX2Y_substream *subs[4];
struct snd_usX2Y_substream * volatile prepare_subs;
struct snd_usx2y_hwdep_pcm_shm *hwdep_pcm_shm;
struct snd_usx2y_substream *subs[4];
struct snd_usx2y_substream * volatile prepare_subs;
wait_queue_head_t prepare_wait_queue;
struct list_head midi_list;
struct list_head pcm_list;
......@@ -51,21 +51,21 @@ struct usX2Ydev {
};
struct snd_usX2Y_substream {
struct usX2Ydev *usX2Y;
struct snd_usx2y_substream {
struct usx2ydev *usx2y;
struct snd_pcm_substream *pcm_substream;
int endpoint;
unsigned int maxpacksize; /* max packet size in bytes */
atomic_t state;
#define state_STOPPED 0
#define state_STARTING1 1
#define state_STARTING2 2
#define state_STARTING3 3
#define state_PREPARED 4
#define state_PRERUNNING 6
#define state_RUNNING 8
#define STATE_STOPPED 0
#define STATE_STARTING1 1
#define STATE_STARTING2 2
#define STATE_STARTING3 3
#define STATE_PREPARED 4
#define STATE_PRERUNNING 6
#define STATE_RUNNING 8
int hwptr; /* free frame position in the buffer (only for playback) */
int hwptr_done; /* processed frame position in the buffer */
......@@ -77,12 +77,12 @@ struct snd_usX2Y_substream {
};
#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data)
#define usx2y(c) ((struct usx2ydev *)(c)->private_data)
int usX2Y_audio_create(struct snd_card *card);
int usx2y_audio_create(struct snd_card *card);
int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y);
int usX2Y_In04_init(struct usX2Ydev *usX2Y);
int usx2y_async_seq04_init(struct usx2ydev *usx2y);
int usx2y_in04_init(struct usx2ydev *usx2y);
#define NAME_ALLCAPS "US-X2Y"
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,7 +4,7 @@
#define MAXSTRIDE 3
#define SSS (((MAXPACK*MAXBUFFERMS*MAXSTRIDE + 4096) / 4096) * 4096)
struct snd_usX2Y_hwdep_pcm_shm {
struct snd_usx2y_hwdep_pcm_shm {
char playback[SSS];
char capture0x8[SSS];
char capture0xA[SSS];
......@@ -20,4 +20,4 @@ struct snd_usX2Y_hwdep_pcm_shm {
int capture_iso_start;
};
int usX2Y_hwdep_pcm_new(struct snd_card *card);
int usx2y_hwdep_pcm_new(struct snd_card *card);
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