Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3712226ybv; Mon, 10 Feb 2020 05:09:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy4JHMrv1WC6IMyhS69Pdddj1FPcpde5xmthFnOzrz+zGCw0d+1B3oVg+L8v8UL3wBjpIoC X-Received: by 2002:a9d:10e:: with SMTP id 14mr948839otu.59.1581340162742; Mon, 10 Feb 2020 05:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581340162; cv=none; d=google.com; s=arc-20160816; b=0DVXKLDFqs+/+CqkGWCSejKuOp+nQBHIpZ2+xJx8Um5Qe/baQAmLkkloNc5CdiP8rv Ox+l/WRKU6Ze5MeT7CLNJlQc3kH/CWnv0J2g2X16rq8DuMg9ewDA4mZxiD/R34jRNZZb Lu5dpUpXjPNcTBmmPH2p2qdnOt7JOBJ8S1PavxVSpXluC9Dzn4Jhfm9ZUllkEHTw/grG wf1mqR6NKig+sjUi+O99QcvbGaKw8aA87wEBAa8XR1OGrqt9Fxj9u99BD9fW/Nyq5L0T AdNoc7jOZGszWNRQqTM7wrAbRIhjmuCGqrcBkqKbaCSkUY9cRM/aHWrHtSArm4RFR2Dj uy3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3jV2ZYWrnxdfFElqKt9aMw3Sn4kHq5pBqg8Zf2mKnII=; b=S9YOu9WPHU20rLJKpVxmDzRZQAg8RAqsf3M9qKVuGd+KJLQtOXPsOyvBTfu4yiJmIT IkQsmEpo9N09AUVBU7oFoYzZKIR4dVvCFg/jo/plgIv1DbWR+cTZO0LBR19qcci49nsh 8m0lvPvlLriC/umMl26L26PQBjyHI0Vjshrwp4QEEqyvEbsQoJnmLQDNCGi7mxs3yKOf TLYx9DaVBAaVDezZ2vv1KF+M75IzhVSolP/njTTWgyNdYrFOSx/xyZg4yZa8vNZ9NVwp f8rlzp8PvLvjNtjZxKXamoS7bHJ1Gg3dcYPLHCvZsSYr79NTJtgZIqkur9ptmu/i99bh nYXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RbcHq1Zy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si157012otr.16.2020.02.10.05.09.11; Mon, 10 Feb 2020 05:09:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RbcHq1Zy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729790AbgBJNII (ORCPT + 99 others); Mon, 10 Feb 2020 08:08:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:37606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729457AbgBJMjh (ORCPT ); Mon, 10 Feb 2020 07:39:37 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8FB5D2051A; Mon, 10 Feb 2020 12:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338376; bh=vHsL6AfawnbWeF5SwmkVlWf8ruzCVLjR6inWgxEaI5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbcHq1ZyJZJoWgBDgJRho1RPUwTbd8RH057WF0tWWrcgP4Asu+kr99RckxgwYChYk lhj6qvX8Q+PY1YmYGbnw6dcUgoWF5MGlIImLAOpDifp22/hFn3G4x+NLcTT8eRt1Ff 3dyle8T45D1CVWpo99dzQMP0BoxFlUuerdouUMQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.5 052/367] ALSA: usb-audio: Annotate endianess in Scarlett gen2 quirk Date: Mon, 10 Feb 2020 04:29:25 -0800 Message-Id: <20200210122428.850363144@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit d8f489355cff55b30731354317739a00cf1238bd upstream. The Scarlett gen2 mixer quirk code defines a few record types to communicate via USB hub, and those must be all little-endian. This patch changes the field types to LE to annotate endianess properly. It also fixes the incorrect usage of leXX_to_cpu() in a couple of places, which was caught by sparse after this change. Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Cc: Link: https://lore.kernel.org/r/20200201080530.22390-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/mixer_scarlett_gen2.c | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -558,11 +558,11 @@ static const struct scarlett2_config /* proprietary request/response format */ struct scarlett2_usb_packet { - u32 cmd; - u16 size; - u16 seq; - u32 error; - u32 pad; + __le32 cmd; + __le16 size; + __le16 seq; + __le32 error; + __le32 pad; u8 data[]; }; @@ -664,11 +664,11 @@ static int scarlett2_usb( "Scarlett Gen 2 USB invalid response; " "cmd tx/rx %d/%d seq %d/%d size %d/%d " "error %d pad %d\n", - le16_to_cpu(req->cmd), le16_to_cpu(resp->cmd), + le32_to_cpu(req->cmd), le32_to_cpu(resp->cmd), le16_to_cpu(req->seq), le16_to_cpu(resp->seq), resp_size, le16_to_cpu(resp->size), - le16_to_cpu(resp->error), - le16_to_cpu(resp->pad)); + le32_to_cpu(resp->error), + le32_to_cpu(resp->pad)); err = -EINVAL; goto unlock; } @@ -687,7 +687,7 @@ error: /* Send SCARLETT2_USB_DATA_CMD SCARLETT2_USB_CONFIG_SAVE */ static void scarlett2_config_save(struct usb_mixer_interface *mixer) { - u32 req = cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); + __le32 req = cpu_to_le32(SCARLETT2_USB_CONFIG_SAVE); scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, &req, sizeof(u32), @@ -713,11 +713,11 @@ static int scarlett2_usb_set_config( const struct scarlett2_config config_item = scarlett2_config_items[config_item_num]; struct { - u32 offset; - u32 bytes; - s32 value; + __le32 offset; + __le32 bytes; + __le32 value; } __packed req; - u32 req2; + __le32 req2; int err; struct scarlett2_mixer_data *private = mixer->private_data; @@ -753,8 +753,8 @@ static int scarlett2_usb_get( int offset, void *buf, int size) { struct { - u32 offset; - u32 size; + __le32 offset; + __le32 size; } __packed req; req.offset = cpu_to_le32(offset); @@ -794,8 +794,8 @@ static int scarlett2_usb_set_mix(struct const struct scarlett2_device_info *info = private->info; struct { - u16 mix_num; - u16 data[SCARLETT2_INPUT_MIX_MAX]; + __le16 mix_num; + __le16 data[SCARLETT2_INPUT_MIX_MAX]; } __packed req; int i, j; @@ -850,9 +850,9 @@ static int scarlett2_usb_set_mux(struct }; struct { - u16 pad; - u16 num; - u32 data[SCARLETT2_MUX_MAX]; + __le16 pad; + __le16 num; + __le32 data[SCARLETT2_MUX_MAX]; } __packed req; req.pad = 0; @@ -911,9 +911,9 @@ static int scarlett2_usb_get_meter_level u16 *levels) { struct { - u16 pad; - u16 num_meters; - u32 magic; + __le16 pad; + __le16 num_meters; + __le32 magic; } __packed req; u32 resp[SCARLETT2_NUM_METERS]; int i, err;