Hi Marcel, On Tue, Oct 12, 2021 at 11:35 PM Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote: > > Hi Luiz, > > > The msft_opcode shall only be changed while at the setup stage otherwise > > it can possible cause problems where different opcodes are used while > > running. > > > > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> > > --- > > v2: Fix typos: s/extention/extension/g > > > > include/net/bluetooth/hci_core.h | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h > > index dd8840e70e25..eb5d4ea88c3a 100644 > > --- a/include/net/bluetooth/hci_core.h > > +++ b/include/net/bluetooth/hci_core.h > > @@ -1272,11 +1272,15 @@ int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb); > > __printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...); > > __printf(2, 3) void hci_set_fw_info(struct hci_dev *hdev, const char *fmt, ...); > > > > -static inline void hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode) > > +static inline int hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode) > > { > > + if (!hci_dev_test_flag(hdev, HCI_SETUP)) > > + return -EPERM; > > + > > #if IS_ENABLED(CONFIG_BT_MSFTEXT) > > hdev->msft_opcode = opcode; > > #endif > > + return 0; > > } > > this is also not going to work since some driver might set it in their probe() routine before calling hci_register_dev. Shall we allow that though? Perhaps we should be checking for HCI_RUNNING then? -- Luiz Augusto von Dentz