summaryrefslogtreecommitdiffstats
path: root/sound/usb/line6/pod.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-05-28 09:05:31 +0200
committerTakashi Iwai <tiwai@suse.de>2019-05-28 09:05:31 +0200
commitf23a09eea1e7947611d985d8cd13d55428ff0af8 (patch)
tree430c10328cbfeb92c08c9712d6bdf1a98513771f /sound/usb/line6/pod.c
parentbe8fd484e9c23e49ffe1d163c8d32c8c7b745941 (diff)
downloadlinux-f23a09eea1e7947611d985d8cd13d55428ff0af8.tar.bz2
ALSA: line6: Use container_of()
... instead of unconditional cast. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/pod.c')
-rw-r--r--sound/usb/line6/pod.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index 995e6ccc8122..9ea720b4b2ab 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -74,6 +74,8 @@ struct usb_line6_pod {
int device_id;
};
+#define line6_to_pod(x) container_of(x, struct usb_line6_pod, line6)
+
#define POD_SYSEX_CODE 3
/* *INDENT-OFF* */
@@ -177,7 +179,7 @@ static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,
*/
static void line6_pod_process_message(struct usb_line6 *line6)
{
- struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
+ struct usb_line6_pod *pod = line6_to_pod(line6);
const unsigned char *buf = pod->line6.buffer_message;
if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {
@@ -274,7 +276,7 @@ static ssize_t device_id_show(struct device *dev,
static void pod_startup(struct usb_line6 *line6)
{
- struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
+ struct usb_line6_pod *pod = line6_to_pod(line6);
switch (pod->startup_progress) {
case POD_STARTUP_VERSIONREQ:
@@ -328,7 +330,7 @@ static int snd_pod_control_monitor_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_pod *pod = (struct usb_line6_pod *)line6pcm->line6;
+ struct usb_line6_pod *pod = line6_to_pod(line6pcm->line6);
ucontrol->value.integer.value[0] = pod->monitor_level;
return 0;
@@ -339,7 +341,7 @@ static int snd_pod_control_monitor_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_pod *pod = (struct usb_line6_pod *)line6pcm->line6;
+ struct usb_line6_pod *pod = line6_to_pod(line6pcm->line6);
if (ucontrol->value.integer.value[0] == pod->monitor_level)
return 0;
@@ -368,7 +370,7 @@ static int pod_init(struct usb_line6 *line6,
const struct usb_device_id *id)
{
int err;
- struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
+ struct usb_line6_pod *pod = line6_to_pod(line6);
line6->process_message = line6_pod_process_message;
line6->startup = pod_startup;