<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/usb/ffs-test.c, branch v4.9.166</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.9.166</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.9.166'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-09-05T07:20:00+00:00</updated>
<entry>
<title>tools: usb: ffs-test: Fix build on big endian systems</title>
<updated>2018-09-05T07:20:00+00:00</updated>
<author>
<name>Peter Senna Tschudin</name>
<email>peter.senna@gmail.com</email>
</author>
<published>2018-07-10T14:01:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3b7c96a9b0ae1c4973d93a4a30939462153c9d73'/>
<id>urn:sha1:3b7c96a9b0ae1c4973d93a4a30939462153c9d73</id>
<content type='text'>
[ Upstream commit a2b22dddc7bb6110ac3b5ed1a60aa9279836fadb ]

The tools/usb/ffs-test.c file defines cpu_to_le16/32 by using the C
library htole16/32 function calls. However, cpu_to_le16/32 are used when
initializing structures, i.e in a context where a function call is not
allowed.

It works fine on little endian systems because htole16/32 are defined by
the C library as no-ops. But on big-endian systems, they are actually
doing something, which might involve calling a function, causing build
failures, such as:

   ffs-test.c:48:25: error: initializer element is not constant
    #define cpu_to_le32(x)  htole32(x)
                            ^~~~~~~
   ffs-test.c:128:12: note: in expansion of macro ‘cpu_to_le32’
      .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
               ^~~~~~~~~~~

To solve this, we code cpu_to_le16/32 in a way that allows them to be
used when initializing structures. This fix was imported from
meta-openembedded/android-tools/fix-big-endian-build.patch written by
Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;.

CC: Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;
Signed-off-by: Peter Senna Tschudin &lt;peter.senna@gmail.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tools: ffs-test: add compatibility code for old kernels</title>
<updated>2014-09-02T14:16:46+00:00</updated>
<author>
<name>Michal Nazarewicz</name>
<email>mina86@mina86.com</email>
</author>
<published>2014-08-27T20:58:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b9a4274699c6973f62979d664cbe7c9aca4f6a9a'/>
<id>urn:sha1:b9a4274699c6973f62979d664cbe7c9aca4f6a9a</id>
<content type='text'>
If ffs-test is used with a kernel prior to 3.14, which do not
support the new descriptors format, it will fail when trying to
write the descriptors.  Add a function that converts the new
descriptors to the legacy ones and use it to retry writing the
descriptors using the legacy format.

Also add “-l” flag to ffs-test which will cause the tool to
never try the new format and instead immediatelly try the
legacy one.  This should be useful to test whether parsing
of the old format still works on given 3.14+ kernel.

Signed-off-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>tools: ffs-test: convert to new descriptor format</title>
<updated>2014-09-02T14:16:46+00:00</updated>
<author>
<name>Michal Nazarewicz</name>
<email>mina86@mina86.com</email>
</author>
<published>2014-08-27T20:58:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=51c208c746e800dba37d1a54d3c5e601630266c4'/>
<id>urn:sha1:51c208c746e800dba37d1a54d3c5e601630266c4</id>
<content type='text'>
Since commit [ac8dde11: “Add flags to descriptors block”] functionfs
supports a new, more powerful and extensible, descriptor format.
Since ffs-test is probably the first thing users of the functionfs
interface see when they start writing functionfs user space daemons,
convert it to use the new format thus promoting it.

Signed-off-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>tools: ffs-test: fix header values endianess</title>
<updated>2014-06-30T18:23:58+00:00</updated>
<author>
<name>Michal Nazarewicz</name>
<email>mina86@mina86.com</email>
</author>
<published>2014-06-13T13:38:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f35f71244da6e51db4e1f2c7e318581f498ececf'/>
<id>urn:sha1:f35f71244da6e51db4e1f2c7e318581f498ececf</id>
<content type='text'>
It appears that no one ever run ffs-test on a big-endian machine,
since it used cpu-endianess for fs_count and hs_count fields which
should be in little-endian format.  Fix by wrapping the numbers in
cpu_to_le32.

Cc: stable@vger.kernel.org
Signed-off-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>Revert "tools: ffs-test: convert to new descriptor format fixing compilation error"</title>
<updated>2014-06-27T15:41:00+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>balbi@ti.com</email>
</author>
<published>2014-06-27T15:41:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9ad7860450ea65c6bbcbd52a9a25b54b07e35941'/>
<id>urn:sha1:9ad7860450ea65c6bbcbd52a9a25b54b07e35941</id>
<content type='text'>
This reverts commit f2af74123f8c5a735248547f4286a3adc28633c1.

There is a better fix for this build error coming in a following
patch.

Signed-of-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>tools: ffs-test: convert to new descriptor format fixing compilation error</title>
<updated>2014-06-19T13:51:35+00:00</updated>
<author>
<name>Michal Nazarewicz</name>
<email>mina86@mina86.com</email>
</author>
<published>2014-05-20T19:38:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f2af74123f8c5a735248547f4286a3adc28633c1'/>
<id>urn:sha1:f2af74123f8c5a735248547f4286a3adc28633c1</id>
<content type='text'>
Commit [ac8dde11: “usb: gadget: f_fs: Add flags to descriptors block”]
which introduced a new descriptor format for FunctionFS removed the
usb_functionfs_descs_head structure, which is still used by ffs-test.
tool.

Convert ffs-test by converting it to use the new header format.  For
testing kernels prior to 3.14 (when the new format was introduced) and
parsing of the legacy headers in the new kernels, provide a compilation
flag to make the tool use the old format.

Finally, include information as to when the legacy FunctionFS headers
format has been deprecated (which is also when the new one has been
introduced).

Reported-by: Lad, Prabhakar &lt;prabhakar.csengg@gmail.com&gt;
Signed-off-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
</content>
</entry>
<entry>
<title>tools: usb: ffs-test: Fix build failure</title>
<updated>2013-03-07T04:23:17+00:00</updated>
<author>
<name>Maxin B. John</name>
<email>maxin.john@enea.com</email>
</author>
<published>2013-02-20T23:57:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a0f11aceee531d444f58b939e6a537ee5e2b9cc5'/>
<id>urn:sha1:a0f11aceee531d444f58b939e6a537ee5e2b9cc5</id>
<content type='text'>
Fixes this build failure:
gcc -Wall -Wextra -g -lpthread -I../include -o testusb testusb.c
gcc -Wall -Wextra -g -lpthread -I../include -o ffs-test ffs-test.c
In file included from ffs-test.c:41:0:
../../include/linux/usb/functionfs.h:4:39: fatal error:
uapi/linux/usb/functionfs.h: No such file or directory
compilation terminated.
make: *** [ffs-test] Error 1

Signed-off-by: Maxin B. John &lt;maxin.john@enea.com&gt;
Acked-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;  # 3.7+
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: ffs-test: fix length argument of out function call</title>
<updated>2012-05-07T23:45:48+00:00</updated>
<author>
<name>Matthias Fend</name>
<email>Matthias.Fend@wolfvision.net</email>
</author>
<published>2012-05-07T12:37:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eb9c5836384cd2a276254df6254ed71117983626'/>
<id>urn:sha1:eb9c5836384cd2a276254df6254ed71117983626</id>
<content type='text'>
The out functions should only handle actual available data instead of the complete buffer.
Otherwise for example the ep0_consume function will report ghost events since it tries to decode
the complete buffer - which may contain partly invalid data.

Signed-off-by: Matthias Fend &lt;matthias.fend@wolfvision.net&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Acked-by: Michal Nazarewicz &lt;mina86@mina86.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2012-03-22T16:40:53+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-03-22T16:40:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=02c502566ef505d0469fa27567f48766c1f5f7af'/>
<id>urn:sha1:02c502566ef505d0469fa27567f48766c1f5f7af</id>
<content type='text'>
Pull x86/build changes from Ingo Molnar.

* 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, build: Fix portability issues when cross-building
  x86, tools: Remove unneeded header files from tools/build.c
  USB: ffs-test: Don't duplicate {get,put}_unaligned*() functions
  x86, efi: Fix endian issues and unaligned accesses
  x86, boot: Restrict CFLAGS for hostprogs
  x86, mkpiggy: Don't open code put_unaligned_le32()
  x86, relocs: Don't open code put_unaligned_le32()
  tools/include: Add byteshift headers for endian access
</content>
</entry>
<entry>
<title>USB: ffs-test: Don't duplicate {get,put}_unaligned*() functions</title>
<updated>2012-02-28T18:23:18+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2012-02-28T13:37:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=24fa9a9d6d70ef7ef7087dce472a8f43a9078da5'/>
<id>urn:sha1:24fa9a9d6d70ef7ef7087dce472a8f43a9078da5</id>
<content type='text'>
Use the header file in tools/include instead of duplicating the endian
functions.

Cc: Davidlohr Bueso &lt;dave@gnu.org&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Link: http://lkml.kernel.org/r/1330436245-24875-7-git-send-email-matt@console-pimps.org
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</content>
</entry>
</feed>
