... instead of unconditional cast.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
int device_id;
};
+#define line6_to_pod(x) container_of(x, struct usb_line6_pod, line6)
+
#define POD_SYSEX_CODE 3
/* *INDENT-OFF* */
*/
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) {
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:
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;
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;
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;
int firmware_version;
};
+#define line6_to_podhd(x) container_of(x, struct usb_line6_podhd, line6)
+
static struct snd_ratden podhd_ratden = {
.num_min = 48000,
.num_max = 48000,
static void podhd_startup(struct usb_line6 *line6)
{
- struct usb_line6_podhd *pod = (struct usb_line6_podhd *)line6;
+ struct usb_line6_podhd *pod = line6_to_podhd(line6);
podhd_dev_start(pod);
line6_read_serial_number(&pod->line6, &pod->serial_number);
static void podhd_disconnect(struct usb_line6 *line6)
{
- struct usb_line6_podhd *pod = (struct usb_line6_podhd *)line6;
+ struct usb_line6_podhd *pod = line6_to_podhd(line6);
if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL_INFO) {
struct usb_interface *intf;
const struct usb_device_id *id)
{
int err;
- struct usb_line6_podhd *pod = (struct usb_line6_podhd *) line6;
+ struct usb_line6_podhd *pod = line6_to_podhd(line6);
struct usb_interface *intf;
line6->disconnect = podhd_disconnect;
struct toneport_led leds[2];
};
+#define line6_to_toneport(x) container_of(x, struct usb_line6_toneport, line6)
+
static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2);
#define TONEPORT_PCM_DELAY 1
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_toneport *toneport =
- (struct usb_line6_toneport *)line6pcm->line6;
+ struct usb_line6_toneport *toneport = line6_to_toneport(line6pcm->line6);
+
ucontrol->value.enumerated.item[0] = toneport->source;
return 0;
}
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_toneport *toneport =
- (struct usb_line6_toneport *)line6pcm->line6;
+ struct usb_line6_toneport *toneport = line6_to_toneport(line6pcm->line6);
unsigned int source;
source = ucontrol->value.enumerated.item[0];
*/
static void line6_toneport_disconnect(struct usb_line6 *line6)
{
- struct usb_line6_toneport *toneport =
- (struct usb_line6_toneport *)line6;
+ struct usb_line6_toneport *toneport = line6_to_toneport(line6);
if (toneport_has_led(toneport))
toneport_remove_leds(toneport);
const struct usb_device_id *id)
{
int err;
- struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6;
+ struct usb_line6_toneport *toneport = line6_to_toneport(line6);
toneport->type = id->driver_info;
int startup_progress;
};
+#define line6_to_variax(x) container_of(x, struct usb_line6_variax, line6)
+
#define VARIAX_OFFSET_ACTIVATE 7
/*
static void variax_startup(struct usb_line6 *line6)
{
- struct usb_line6_variax *variax = (struct usb_line6_variax *)line6;
+ struct usb_line6_variax *variax = line6_to_variax(line6);
switch (variax->startup_progress) {
case VARIAX_STARTUP_VERSIONREQ:
*/
static void line6_variax_process_message(struct usb_line6 *line6)
{
- struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
+ struct usb_line6_variax *variax = line6_to_variax(line6);
const unsigned char *buf = variax->line6.buffer_message;
switch (buf[0]) {
*/
static void line6_variax_disconnect(struct usb_line6 *line6)
{
- struct usb_line6_variax *variax = (struct usb_line6_variax *)line6;
+ struct usb_line6_variax *variax = line6_to_variax(line6);
kfree(variax->buffer_activate);
}
static int variax_init(struct usb_line6 *line6,
const struct usb_device_id *id)
{
- struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
+ struct usb_line6_variax *variax = line6_to_variax(line6);
int err;
line6->process_message = line6_variax_process_message;