Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240107

Re: [PATCH] usb: gadget: f_uac1: Convert use of __constant_cpu_to_le16 to cpu_to_le16

Path csiph.com!eternal-september.org!feeder.eternal-september.org!weretis.net!feeder1.news.weretis.net!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod
From Vaishali Thakkar <vthakkar1994@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: gadget: f_uac1: Convert use of __constant_cpu_to_le16 to cpu_to_le16
Date Tue, 06 Oct 2015 03:40:02 +0200
Message-ID <qgpou-8an-7@gated-at.bofh.it> (permalink)
References <pZ4gq-4Yl-11@gated-at.bofh.it> <pZvJE-2Cq-13@gated-at.bofh.it> <q06ga-4Gw-9@gated-at.bofh.it> <q0VVn-3cH-7@gated-at.bofh.it> <q0Xu9-5hU-9@gated-at.bofh.it> <qgnmF-5iM-3@gated-at.bofh.it>
X-Original-To Felipe Balbi <balbi@ti.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xI1JUtIGRaCnpKVEGk4FKQd0eYwPn5e55TiNY4pRRHo=; b=NKhpyjQMdk+ex+oKs7UhheSt07Qgtr/gWZH2OU9x7J0Ip4rgrbMMyzCHNC8+ZPNQVI yQD84YYavENrmeQ9WtS3GLFzF7fPiaBdHQ3uK5Aqmz1oykhD7va7xU+OeS/NS5qQRF1H E+I88lSFepNSdhoTwN2C2aOGRxqIuFQh0blyjTSbakD5klj2+1/sYNueSCnnuB7QEOdY ZFSnDKg9Q0G6yem8xM3gjEECZmgby+wvkbi0ZbmpEgvrfrgcjqU6u05MKsD3O+E3oWuo v1DUi1KDqPi3WT6/4Iab8Z/HP3yKd3O9DISZBq1h3vmv1qqXeg+TkGDnWFN05gc/3NQM JzrA==
MIME-Version 1.0
X-Received by 10.194.110.37 with SMTP id hx5mr33057206wjb.149.1444095500956; Mon, 05 Oct 2015 18:38:20 -0700 (PDT)
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc David Laight <David.Laight@aculab.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Tue, 6 Oct 2015 07:08:20 +0530
X-Original-Message-ID <CAK-LDbLHwtGjOSdGZ+t+TY0D4maurnPa5gqHn5ayETbFeRLiTA@mail.gmail.com>
X-Original-References <20150819053122.GA11573@localhost> <063D6719AE5E284EB5DD2968C1650D6D1CB804E2@AcuExch.aculab.com> <CAK-LDbJA62A-+N611LJV5tg+HGWWLi1-ZF1BZBZ_cPDTKPVK+Q@mail.gmail.com> <063D6719AE5E284EB5DD2968C1650D6D1CB822B8@AcuExch.aculab.com> <CAK-LDbLvYqj3AdSu-aWryp116u0q7mgaYKn_=h54DV_WrrjAqA@mail.gmail.com> <871td8gai1.fsf@saruman.tx.rr.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1240107

Show key headers only | View raw


On Tue, Oct 6, 2015 at 4:59 AM, Felipe Balbi <balbi@ti.com> wrote:
> Vaishali Thakkar <vthakkar1994@gmail.com> writes:
>
>> On Mon, Aug 24, 2015 at 2:29 PM, David Laight <David.Laight@aculab.com> 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_<foo> are already converted to <foo>?
>>>>
>>>> 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.
>
> it's unclear to me if this is really safe to apply. Until then I'm
> dropping this from queue. Seems like, at a minimum, we need a better
> commit log

I compared both .s files [before the change and after the change] and
I don't see any difference between instructions in them. I am not sure
but it looks like if expression contains 'a ? t : f' then either 't'
OR 'f' should
be constant not both.

Also, the code still complies on little endian machines after changing
cpu_to_be16(). And on top of that fact is there are many patches
applied in the kernel from years for the same and very less are remaining.
In case, this fails then I think we need to change those cases as well. But
I have never seen people reporting a bug for the same and changing
<foo> to __constant_<foo> again.

Still I think probably it would be good if someone can test this patch on big
endian machine [just to be sure about the change].

> --
> balbi



-- 
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/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH] usb: gadget: f_uac1: Convert use of __constant_cpu_to_le16 to cpu_to_le16 Felipe Balbi <balbi@ti.com> - 2015-10-06 01:30 +0200
  Re: [PATCH] usb: gadget: f_uac1: Convert use of __constant_cpu_to_le16  to cpu_to_le16 Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-10-06 03:40 +0200

csiph-web