From: Takashi Iwai Subject: Re: [PATCH 0/7] ALSA: USB-audio: Support Zoom R16 playback Date: Fri, 16 Oct 2015 12:13:54 +0200 Message-ID: References: <1444906657-16791-1-git-send-email-ricardw@axis.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E778626065C for ; Fri, 16 Oct 2015 12:13:54 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Ricard Wanderlof Cc: alsa-devel , Ricard Wanderlof List-Id: alsa-devel@alsa-project.org On Fri, 16 Oct 2015 09:22:01 +0200, Ricard Wanderlof wrote: > > > On Fri, 16 Oct 2015, Takashi Iwai wrote: > > > The changes look OK, the only point to be fixed would be the use of > > __le32 for a variable as kbuild bot suggested. > > Ok, however I interpreted the kbuild warning as that the output type of > cpu_to_le32() is the same as the input type, so the resulting 'unsigned > int' might not necessarily fit into the target u32 variable. So when the > input type is an unsigned int, it should be cast to an u32 to be the same > as the output type. > > I looked around in various parts of the kernel code to see how > cpu_to_le32() was used, and most cases have an u32 as the argument, and > when not, the argument is simply cast to u32, i.e. > > unsigned int length; > u32 packet_length = cpu_to_le32((u32)length); No, other way round: the problem is that packet_length is declared as u32 while it should be __le32. The length variable must be CPU endian, of course, as you apply C arithmetic. Takashi