Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752907AbcDUOoy (ORCPT ); Thu, 21 Apr 2016 10:44:54 -0400 Received: from gw.hale.at ([83.64.51.210]:52572 "EHLO gw.hale.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbcDUOot (ORCPT ); Thu, 21 Apr 2016 10:44:49 -0400 X-HALE-Mailborder-Watermark: 1461854686.38362@Nl8FI2zZ2MyqW1XQ9lpm7g X-HALE-Mailborder-From: michael.thalmeier@hale.at X-HALE-Mailborder-SpamCheck: not spam, SpamAssassin (zwischen gespeichert, Wertung=-2.899, benoetigt 3, autolearn=not spam, ALL_TRUSTED -1.00, BAYES_00 -1.90, URIBL_BLOCKED 0.00) X-HALE-Mailborder-IP-Protocol: IPv4 X-HALE-Mailborder: Found to be clean X-HALE-Mailborder-ID: 627502C14C2.A8449 X-HALE-Mailborder-Information: Please contact your admin for more information From: Michael Thalmeier To: Samuel Ortiz Cc: Lauro Ramos Venancio , Aloisio Almeida Jr , linux-kernel@vger.kernel.org, linux-nfc@ml01.01.org, michael@thalmeier.at Subject: [PATCH 02/11] NFC: pn533: fix order of initialization Date: Thu, 21 Apr 2016 16:43:50 +0200 Message-Id: <1461249839-16962-3-git-send-email-michael.thalmeier@hale.at> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1461249839-16962-1-git-send-email-michael.thalmeier@hale.at> References: <1461249839-16962-1-git-send-email-michael.thalmeier@hale.at> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2721 Lines: 84 Correctly call nfc_set_parent_dev before nfc_register_device. Otherwise the driver will oops when being removed. Signed-off-by: Michael Thalmeier --- drivers/nfc/pn533/i2c.c | 3 ++- drivers/nfc/pn533/pn533.c | 4 +++- drivers/nfc/pn533/pn533.h | 3 ++- drivers/nfc/pn533/usb.c | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c index 1a622e1..0141f19 100644 --- a/drivers/nfc/pn533/i2c.c +++ b/drivers/nfc/pn533/i2c.c @@ -211,7 +211,8 @@ static int pn533_i2c_probe(struct i2c_client *client, 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); diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index ee9e8f1..d82eecd 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -2554,7 +2554,8 @@ struct pn533 *pn533_register_device(u32 device_type, 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; @@ -2617,6 +2618,7 @@ struct pn533 *pn533_register_device(u32 device_type, 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); diff --git a/drivers/nfc/pn533/pn533.h b/drivers/nfc/pn533/pn533.h index ba604f6..553c7d1 100644 --- a/drivers/nfc/pn533/pn533.h +++ b/drivers/nfc/pn533/pn533.h @@ -228,7 +228,8 @@ struct pn533 *pn533_register_device(u32 device_type, 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); diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c index 4f73cbf..8ca0603 100644 --- a/drivers/nfc/pn533/usb.c +++ b/drivers/nfc/pn533/usb.c @@ -536,7 +536,7 @@ static int pn533_usb_probe(struct usb_interface *interface, 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); @@ -544,7 +544,6 @@ static int pn533_usb_probe(struct usb_interface *interface, } phy->priv = priv; - nfc_set_parent_dev(priv->nfc_dev, &interface->dev); usb_set_intfdata(interface, phy); -- 2.5.5