nfc: constify nci_ops
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Sat, 24 Jul 2021 21:47:33 +0000 (23:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 25 Jul 2021 08:21:20 +0000 (09:21 +0100)
commitb9c28286d8f1822a10f702fcefe0b8a1db4e6917
tree4220028d575e0cac82c578cd243e31947e8df0c3
parent48d5440393d328cfe18b26e3609c84c0f41d6515
nfc: constify nci_ops

The struct nci_ops is modified by NFC core in only one case:
nci_allocate_device() receives too many proprietary commands (prop_ops)
to configure.  This is a build time known constrain, so a graceful
handling of such case is not necessary.

Instead, fail the nci_allocate_device() and add BUILD_BUG_ON() to places
which set these.

This allows to constify the struct nci_ops (consisting of function
pointers) for correctness and safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/nfc/fdp/fdp.c
drivers/nfc/nfcmrvl/main.c
drivers/nfc/nxp-nci/core.c
drivers/nfc/st-nci/core.c
drivers/nfc/virtual_ncidev.c
include/net/nfc/nci_core.h
net/nfc/nci/core.c