Correctly call nfc_set_parent_dev before nfc_register_device.
Otherwise the driver will OOPS when being removed.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
                                     PN533_NO_TYPE_B_PROTOCOLS,
                                     PN533_PROTO_REQ_ACK_RESP,
                                     phy, &i2c_phy_ops, NULL,
-                                    &phy->i2c_dev->dev);
+                                    &phy->i2c_dev->dev,
+                                    &client->dev);
 
        if (IS_ERR(priv)) {
                r = PTR_ERR(priv);
 
                                void *phy,
                                struct pn533_phy_ops *phy_ops,
                                struct pn533_frame_ops *fops,
-                               struct device *dev)
+                               struct device *dev,
+                               struct device *parent)
 {
        struct pn533_fw_version fw_ver;
        struct pn533 *priv;
                goto destroy_wq;
        }
 
+       nfc_set_parent_dev(priv->nfc_dev, parent);
        nfc_set_drvdata(priv->nfc_dev, priv);
 
        rc = nfc_register_device(priv->nfc_dev);
 
                                void *phy,
                                struct pn533_phy_ops *phy_ops,
                                struct pn533_frame_ops *fops,
-                               struct device *dev);
+                               struct device *dev,
+                               struct device *parent);
 
 void pn533_unregister_device(struct pn533 *priv);
 void pn533_recv_frame(struct pn533 *dev, struct sk_buff *skb, int status);
 
 
        priv = pn533_register_device(id->driver_info, protocols, protocol_type,
                                        phy, &usb_phy_ops, fops,
-                                       &phy->udev->dev);
+                                       &phy->udev->dev, &interface->dev);
 
        if (IS_ERR(priv)) {
                rc = PTR_ERR(priv);
        }
 
        phy->priv = priv;
-       nfc_set_parent_dev(priv->nfc_dev, &interface->dev);
 
        usb_set_intfdata(interface, phy);