summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533/pn533.h
diff options
context:
space:
mode:
authorLars Poeschel <poeschel@lemonage.de>2019-10-29 15:46:46 +0100
committerDavid S. Miller <davem@davemloft.net>2019-10-29 21:05:26 -0700
commit843cc92ed323692943c94d7e6ce97a0353b8c2d7 (patch)
treee2a9210b2aa95ba8f3ad4560092ad9fba4edb9a2 /drivers/nfc/pn533/pn533.h
parent0bf2840ccc6efcba82d83b224dcde19dea9f1ee3 (diff)
downloadlinux-stable-843cc92ed323692943c94d7e6ce97a0353b8c2d7.tar.gz
linux-stable-843cc92ed323692943c94d7e6ce97a0353b8c2d7.tar.bz2
linux-stable-843cc92ed323692943c94d7e6ce97a0353b8c2d7.zip
nfc: pn533: Split pn533 init & nfc_register
There is a problem in the initialisation and setup of the pn533: It registers with nfc too early. It could happen, that it finished registering with nfc and someone starts using it. But setup of the pn533 is not yet finished. Bad or at least unintended things could happen. So I split out nfc registering (and unregistering) to seperate functions that have to be called late in probe then. i2c requires a bit more love: i2c requests an irq in it's probe function. 'Commit 32ecc75ded72 ("NFC: pn533: change order operations in dev registation")' shows, this can not happen too early. An irq can be served before structs are fully initialized. The way chosen to prevent this is to request the irq after nfc_alloc_device initialized the structs, but before nfc_register_device. So there is now this pn532_i2c_nfc_alloc function. Cc: Johan Hovold <johan@kernel.org> Cc: Claudiu Beznea <Claudiu.Beznea@microchip.com> Cc: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nfc/pn533/pn533.h')
-rw-r--r--drivers/nfc/pn533/pn533.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/nfc/pn533/pn533.h b/drivers/nfc/pn533/pn533.h
index 570ee0a3e832..984f79fef59e 100644
--- a/drivers/nfc/pn533/pn533.h
+++ b/drivers/nfc/pn533/pn533.h
@@ -219,18 +219,21 @@ struct pn533_phy_ops {
};
-struct pn533 *pn533_register_device(u32 device_type,
- u32 protocols,
+struct pn533 *pn53x_common_init(u32 device_type,
enum pn533_protocol_type protocol_type,
void *phy,
struct pn533_phy_ops *phy_ops,
struct pn533_frame_ops *fops,
- struct device *dev,
- struct device *parent);
+ struct device *dev);
int pn533_finalize_setup(struct pn533 *dev);
-void pn533_unregister_device(struct pn533 *priv);
+void pn53x_common_clean(struct pn533 *priv);
void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status);
+int pn532_i2c_nfc_alloc(struct pn533 *priv, u32 protocols,
+ struct device *parent);
+int pn53x_register_nfc(struct pn533 *priv, u32 protocols,
+ struct device *parent);
+void pn53x_unregister_nfc(struct pn533 *priv);
bool pn533_rx_frame_is_cmd_response(struct pn533 *dev, void *frame);
bool pn533_rx_frame_is_ack(void *_frame);