.. | .. |
---|
109 | 109 | (unsigned)__entry->actual, (unsigned)__entry->frame) |
---|
110 | 110 | ); |
---|
111 | 111 | |
---|
| 112 | +/* |
---|
| 113 | + * consider a buffer valid if non-NULL and if it doesn't match the dummy buffer |
---|
| 114 | + * that only exist to work with controllers that have SPI_CONTROLLER_MUST_TX or |
---|
| 115 | + * SPI_CONTROLLER_MUST_RX. |
---|
| 116 | + */ |
---|
| 117 | +#define spi_valid_txbuf(msg, xfer) \ |
---|
| 118 | + (xfer->tx_buf && xfer->tx_buf != msg->spi->controller->dummy_tx) |
---|
| 119 | +#define spi_valid_rxbuf(msg, xfer) \ |
---|
| 120 | + (xfer->rx_buf && xfer->rx_buf != msg->spi->controller->dummy_rx) |
---|
| 121 | + |
---|
112 | 122 | DECLARE_EVENT_CLASS(spi_transfer, |
---|
113 | 123 | |
---|
114 | 124 | TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer), |
---|
.. | .. |
---|
120 | 130 | __field( int, chip_select ) |
---|
121 | 131 | __field( struct spi_transfer *, xfer ) |
---|
122 | 132 | __field( int, len ) |
---|
| 133 | + __dynamic_array(u8, rx_buf, |
---|
| 134 | + spi_valid_rxbuf(msg, xfer) ? |
---|
| 135 | + (xfer->len < 64 ? xfer->len : 64) : 0) |
---|
| 136 | + __dynamic_array(u8, tx_buf, |
---|
| 137 | + spi_valid_txbuf(msg, xfer) ? |
---|
| 138 | + (xfer->len < 64 ? xfer->len : 64) : 0) |
---|
123 | 139 | ), |
---|
124 | 140 | |
---|
125 | 141 | TP_fast_assign( |
---|
.. | .. |
---|
127 | 143 | __entry->chip_select = msg->spi->chip_select; |
---|
128 | 144 | __entry->xfer = xfer; |
---|
129 | 145 | __entry->len = xfer->len; |
---|
| 146 | + |
---|
| 147 | + if (spi_valid_txbuf(msg, xfer)) |
---|
| 148 | + memcpy(__get_dynamic_array(tx_buf), |
---|
| 149 | + xfer->tx_buf, __get_dynamic_array_len(tx_buf)); |
---|
| 150 | + |
---|
| 151 | + if (spi_valid_rxbuf(msg, xfer)) |
---|
| 152 | + memcpy(__get_dynamic_array(rx_buf), |
---|
| 153 | + xfer->rx_buf, __get_dynamic_array_len(rx_buf)); |
---|
130 | 154 | ), |
---|
131 | 155 | |
---|
132 | | - TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num, |
---|
133 | | - (int)__entry->chip_select, |
---|
134 | | - (struct spi_message *)__entry->xfer, |
---|
135 | | - (int)__entry->len) |
---|
| 156 | + TP_printk("spi%d.%d %p len=%d tx=[%*phD] rx=[%*phD]", |
---|
| 157 | + __entry->bus_num, __entry->chip_select, |
---|
| 158 | + __entry->xfer, __entry->len, |
---|
| 159 | + __get_dynamic_array_len(tx_buf), __get_dynamic_array(tx_buf), |
---|
| 160 | + __get_dynamic_array_len(rx_buf), __get_dynamic_array(rx_buf)) |
---|
136 | 161 | ); |
---|
137 | 162 | |
---|
138 | 163 | DEFINE_EVENT(spi_transfer, spi_transfer_start, |
---|