Re: [PATCH v6 0/3] usb: gadget: reduce usb gadget trace event buffer usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 15, 2023 at 01:27:13PM +0800, Linyu Yuan wrote:
> some trace event use an interger to to save a bit field info of gadget,
> also some trace save endpoint name in string forat, it all can be
> chagned to other way at trace event store phase.
> 
> bit field can be replace with a union interger member which include
> multiple bit fields.
> 
> ep name stringe can be replace to a interger which contaion number
> and dir info.
> 
> in order to avoid big endian issue, save interger data into ring
> buffer in __le32 format.

This won't do what you want.  cpu_to_le32() puts the _bytes_ in order 
from least significant to most significant.  But what you want is to put 
the _bits_ in order.

For example, suppose sg_supported ends up sitting in BIT(31) and it is 
the only flag set.  The value of g->dw1 would be 0x80000000.  Then 
cpu_to_le32(g->dw1) would be 0x00000080, not 0x00000001.

You should do what I wrote earlier:

	__entry->dw1 = (g->sg_supported << 0) |
			(g->is_otg << 1) |
			...

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux