Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932407AbbHXKmb (ORCPT ); Mon, 24 Aug 2015 06:42:31 -0400 Received: from mail-yk0-f170.google.com ([209.85.160.170]:32818 "EHLO mail-yk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbbHXKma (ORCPT ); Mon, 24 Aug 2015 06:42:30 -0400 MIME-Version: 1.0 In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CB822B8@AcuExch.aculab.com> References: <20150819053122.GA11573@localhost> <063D6719AE5E284EB5DD2968C1650D6D1CB804E2@AcuExch.aculab.com> <063D6719AE5E284EB5DD2968C1650D6D1CB822B8@AcuExch.aculab.com> Date: Mon, 24 Aug 2015 16:12:29 +0530 Message-ID: Subject: Re: [PATCH] usb: gadget: f_uac1: Convert use of __constant_cpu_to_le16 to cpu_to_le16 From: Vaishali Thakkar To: David Laight Cc: Felipe Balbi , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1883 Lines: 48 On Mon, Aug 24, 2015 at 2:29 PM, David Laight wrote: > From: Vaishali Thakkar [mailto:vthakkar1994@gmail.com] >> Sent: 22 August 2015 02:57 > ... >> >> - .bcdADC = __constant_cpu_to_le16(0x0100), >> >> - .wTotalLength = __constant_cpu_to_le16(UAC_DT_TOTAL_LENGTH), >> >> + .bcdADC = cpu_to_le16(0x0100), >> >> + .wTotalLength = cpu_to_le16(UAC_DT_TOTAL_LENGTH), >> > >> > Have you test compiled this on a big-endian system? >> > My gut feeling is that is fails. >> >> No. I have tested it on little-endian system only. But I'll >> be really surprised if this will fail. Can you please tell me >> if I am missing something in this particular case or same >> applies for other cases because most of the cases like >> __constant_ are already converted to ? >> >> As far as I know, if the argument is a constant the >> conversion happens at compile time. And unfolding both >> definitions returns to same expression. Still I am trying if >> someone can test it for me on big endian system. > > Flip one to cpu_to_be16() and see if it still compiles. Yes. It still compiles. > Static initialisers and case labels can be expressions, but the > expression itself must only contain constants. > So it needs to be constant regardless of the value of any constants. > If it contains 'a ? t : f' then both 't' and 'f' must be constant. > > In code, if 'a' is constant the optimiser discards one of 't' or 'f'. > I'm not sure what happens for non-static initialisers (they generate > odd code at the best of times). > > David > -- Vaishali -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/