Re: [PATCH v6] Bluetooth: hci_uart: Support firmware download for Marvell
From: kbuild test robot
Date: Sat Apr 02 2016 - 11:06:36 EST
Hi Ganapathi,
[auto build test ERROR on v4.6-rc1]
[also build test ERROR on next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Amitkumar-Karwar/Bluetooth-hci_uart-Support-firmware-download-for-Marvell/20160331-200638
config: x86_64-randconfig-s0-04022220 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
>> drivers/bluetooth/hci_mrvl.c:136:33: error: array type has incomplete element type 'struct h4_recv_pkt'
static const struct h4_recv_pkt mrvl_recv_pkts[] = {
^
>> drivers/bluetooth/hci_mrvl.c:137:4: error: 'H4_RECV_ACL' undeclared here (not in a function)
{ H4_RECV_ACL, .recv = hci_recv_frame },
^
>> drivers/bluetooth/hci_mrvl.c:137:19: error: field name not in record or union initializer
{ H4_RECV_ACL, .recv = hci_recv_frame },
^
drivers/bluetooth/hci_mrvl.c:137:19: note: (near initialization for 'mrvl_recv_pkts')
>> drivers/bluetooth/hci_mrvl.c:138:4: error: 'H4_RECV_SCO' undeclared here (not in a function)
{ H4_RECV_SCO, .recv = hci_recv_frame },
^
drivers/bluetooth/hci_mrvl.c:138:19: error: field name not in record or union initializer
{ H4_RECV_SCO, .recv = hci_recv_frame },
^
drivers/bluetooth/hci_mrvl.c:138:19: note: (near initialization for 'mrvl_recv_pkts')
>> drivers/bluetooth/hci_mrvl.c:139:4: error: 'H4_RECV_EVENT' undeclared here (not in a function)
{ H4_RECV_EVENT, .recv = hci_recv_frame },
^
drivers/bluetooth/hci_mrvl.c:139:19: error: field name not in record or union initializer
{ H4_RECV_EVENT, .recv = hci_recv_frame },
^
drivers/bluetooth/hci_mrvl.c:139:19: note: (near initialization for 'mrvl_recv_pkts')
drivers/bluetooth/hci_mrvl.c: In function 'mrvl_recv':
>> drivers/bluetooth/hci_mrvl.c:244:17: error: implicit declaration of function 'h4_recv_buf' [-Werror=implicit-function-declaration]
mrvl->rx_skb = h4_recv_buf(hu->hdev, mrvl->rx_skb, data, count,
^
In file included from include/linux/thread_info.h:11:0,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/bluetooth/hci_mrvl.c:22:
>> include/linux/bug.h:34:45: error: bit-field '<anonymous>' width not an integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
^
include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/kernel.h:54:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
>> drivers/bluetooth/hci_mrvl.c:245:24: note: in expansion of macro 'ARRAY_SIZE'
mrvl_recv_pkts, ARRAY_SIZE(mrvl_recv_pkts));
^
drivers/bluetooth/hci_mrvl.c: At top level:
>> drivers/bluetooth/hci_mrvl.c:136:33: warning: 'mrvl_recv_pkts' defined but not used [-Wunused-variable]
static const struct h4_recv_pkt mrvl_recv_pkts[] = {
^
cc1: some warnings being treated as errors
vim +136 drivers/bluetooth/hci_mrvl.c
130 memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
131 skb_queue_tail(&mrvl->txq, skb);
132
133 return 0;
134 }
135
> 136 static const struct h4_recv_pkt mrvl_recv_pkts[] = {
> 137 { H4_RECV_ACL, .recv = hci_recv_frame },
> 138 { H4_RECV_SCO, .recv = hci_recv_frame },
> 139 { H4_RECV_EVENT, .recv = hci_recv_frame },
140 };
141
142 /* Send ACK/NAK to the device */
143 static void mrvl_send_ack(struct hci_uart *hu, unsigned char ack)
144 {
145 struct tty_struct *tty = hu->tty;
146
147 tty->ops->write(tty, &ack, sizeof(ack));
148 }
149
150 /* Validate the feedback data from device */
151 static void mrvl_pkt_complete(struct hci_uart *hu, struct sk_buff *skb)
152 {
153 struct mrvl_data *mrvl = hu->priv;
154 struct fw_data *fw_data = mrvl->fwdata;
155 u8 buf[MRVL_FW_HDR_LEN];
156 u16 lhs, rhs;
157
158 memcpy(buf, skb->data, skb->len);
159
160 lhs = le16_to_cpu(*((__le16 *)(&buf[1])));
161 rhs = le16_to_cpu(*((__le16 *)(&buf[3])));
162 if ((lhs ^ rhs) == 0xffff) {
163 mrvl_send_ack(hu, MRVL_ACK);
164 fw_data->wait_fw = 1;
165 fw_data->next_len = lhs;
166 /*firmware download is done, send the last ack*/
167 if (!lhs)
168 fw_data->last_ack = 1;
169
170 if (unlikely(fw_data->expected_ack == MRVL_HDR_CHIP_VER)) {
171 fw_data->chip_id = *((u8 *)(&buf[1]));
172 fw_data->chip_rev = *((u8 *)(&buf[2]));
173 }
174 wake_up_interruptible(&fw_data->init_wait_q);
175 } else {
176 mrvl_send_ack(hu, MRVL_NAK);
177 }
178 }
179
180 /* This function receives data from the uart device during firmware download.
181 * Driver expects 5 bytes of data as per the protocal in the below format:
182 * <HEADER><BYTE_1><BYTE_2><BYTE_3><BYTE_4>
183 * BYTE_3 and BYTE_4 are compliment of BYTE_1 an BYTE_2. Data can come in chunks
184 * of any length. If length received is < 5, accumulate the data in an array,
185 * until we have a sequence of 5 bytes, starting with the expected HEADER. If
186 * the length received is > 5 bytes, then get the first 5 bytes, starting with
187 * the HEADER and process the same, ignoring the rest of the bytes as per the
188 * protocal.
189 */
190 static struct sk_buff *mrvl_process_fw_data(struct hci_uart *hu,
191 struct sk_buff *skb,
192 u8 *buf, int count)
193 {
194 struct mrvl_data *mrvl = hu->priv;
195 struct fw_data *fw_data = mrvl->fwdata;
196 int i = 0, len;
197
198 if (!skb) {
199 while (buf[i] != fw_data->expected_ack && i < count)
200 i++;
201 if (i == count)
202 return ERR_PTR(-EILSEQ);
203
204 skb = bt_skb_alloc(MRVL_FW_HDR_LEN, GFP_KERNEL);
205 }
206
207 if (!skb)
208 return ERR_PTR(-ENOMEM);
209
210 len = count - i;
211 memcpy(skb_put(skb, len), &buf[i], len);
212
213 if (skb->len == MRVL_FW_HDR_LEN) {
214 mrvl_pkt_complete(hu, skb);
215 kfree_skb(skb);
216 skb = NULL;
217 }
218
219 return skb;
220 }
221
222 /* Receive data */
223 static int mrvl_recv(struct hci_uart *hu, const void *data, int count)
224 {
225 struct mrvl_data *mrvl = hu->priv;
226
227 if (test_bit(HCI_UART_DNLD_FW, &mrvl->flags)) {
228 mrvl->fwdata->skb = mrvl_process_fw_data(hu, mrvl->fwdata->skb,
229 (u8 *)data, count);
230 if (IS_ERR(mrvl->fwdata->skb)) {
231 int err = PTR_ERR(mrvl->fwdata->skb);
232
233 bt_dev_err(hu->hdev,
234 "Receive firmware data failed (%d)", err);
235 mrvl->fwdata->skb = NULL;
236 return err;
237 }
238 return 0;
239 }
240
241 if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
242 return -EUNATCH;
243
> 244 mrvl->rx_skb = h4_recv_buf(hu->hdev, mrvl->rx_skb, data, count,
> 245 mrvl_recv_pkts, ARRAY_SIZE(mrvl_recv_pkts));
246 if (IS_ERR(mrvl->rx_skb)) {
247 int err = PTR_ERR(mrvl->rx_skb);
248
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data