Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFC: nfcmrvl: configure head/tail room values per low level drivers

Low-level drivers may need to add some data before and/or
after NCI packet.

Signed-off-by: Vincent Cuissard <cuissard@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Vincent Cuissard and committed by
Samuel Ortiz
58d34aa6 3194c687

+14 -9
+9 -4
drivers/nfc/nfcmrvl/main.c
··· 97 97 .fw_download = nfcmrvl_nci_fw_download, 98 98 }; 99 99 100 - struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data, 100 + struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, 101 + void *drv_data, 101 102 struct nfcmrvl_if_ops *ops, 102 103 struct device *dev, 103 104 struct nfcmrvl_platform_data *pdata) 104 105 { 105 106 struct nfcmrvl_private *priv; 106 107 int rc; 107 - int headroom = 0; 108 + int headroom; 109 + int tailroom; 108 110 u32 protocols; 109 111 110 112 priv = kzalloc(sizeof(*priv), GFP_KERNEL); ··· 116 114 priv->drv_data = drv_data; 117 115 priv->if_ops = ops; 118 116 priv->dev = dev; 117 + priv->phy = phy; 119 118 120 119 memcpy(&priv->config, pdata, sizeof(*pdata)); 121 120 ··· 129 126 nfc_err(dev, "failed to request reset_n io\n"); 130 127 } 131 128 129 + headroom = tailroom = 0; 130 + 132 131 if (priv->config.hci_muxed) 133 - headroom = NFCMRVL_HCI_EVENT_HEADER_SIZE; 132 + headroom += NFCMRVL_HCI_EVENT_HEADER_SIZE; 134 133 135 134 protocols = NFC_PROTO_JEWEL_MASK 136 135 | NFC_PROTO_MIFARE_MASK ··· 143 138 | NFC_PROTO_NFC_DEP_MASK; 144 139 145 140 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, 146 - headroom, 0); 141 + headroom, tailroom); 147 142 if (!priv->ndev) { 148 143 nfc_err(dev, "nci_allocate_device failed\n"); 149 144 rc = -ENOMEM;
+2 -1
drivers/nfc/nfcmrvl/nfcmrvl.h
··· 100 100 101 101 void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv); 102 102 int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb); 103 - struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data, 103 + struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, 104 + void *drv_data, 104 105 struct nfcmrvl_if_ops *ops, 105 106 struct device *dev, 106 107 struct nfcmrvl_platform_data *pdata);
+2 -2
drivers/nfc/nfcmrvl/uart.c
··· 138 138 pdata = &config; 139 139 } 140 140 141 - priv = nfcmrvl_nci_register_dev(nu, &uart_ops, nu->tty->dev, pdata); 141 + priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_UART, nu, &uart_ops, 142 + nu->tty->dev, pdata); 142 143 if (IS_ERR(priv)) 143 144 return PTR_ERR(priv); 144 145 145 - priv->phy = NFCMRVL_PHY_UART; 146 146 priv->support_fw_dnld = true; 147 147 148 148 nu->drv_data = priv;
+1 -2
drivers/nfc/nfcmrvl/usb.c
··· 340 340 init_usb_anchor(&drv_data->bulk_anchor); 341 341 init_usb_anchor(&drv_data->deferred); 342 342 343 - priv = nfcmrvl_nci_register_dev(drv_data, &usb_ops, 343 + priv = nfcmrvl_nci_register_dev(NFCMRVL_PHY_USB, drv_data, &usb_ops, 344 344 &drv_data->udev->dev, &config); 345 345 if (IS_ERR(priv)) 346 346 return PTR_ERR(priv); 347 347 348 348 drv_data->priv = priv; 349 - drv_data->priv->phy = NFCMRVL_PHY_USB; 350 349 drv_data->priv->support_fw_dnld = false; 351 350 352 351 priv->dev = &drv_data->udev->dev;