Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751942AbdFISfA (ORCPT ); Fri, 9 Jun 2017 14:35:00 -0400 Received: from david.siemens.de ([192.35.17.14]:54961 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbdFISde (ORCPT ); Fri, 9 Jun 2017 14:33:34 -0400 From: Jan Kiszka To: Linus Walleij , Alexandre Courbot Cc: Greg Kroah-Hartman , Linux Kernel Mailing List , linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, Sudip Mukherjee , Andy Shevchenko , Sascha Weisenberger Subject: [PATCH v6 02/10] gpio-exar/8250-exar: Fix passing in of parent PCI device Date: Fri, 9 Jun 2017 20:33:10 +0200 Message-Id: <6f2e19cfb8bcb9acf4b042e4db716e93286862d6.1497033197.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1705 Lines: 46 This fixes reloading of the GPIO driver for the same platform device instance as created by the exar UART driver: First of all, the driver sets drvdata to its own value during probing and does not restore the original value on exit. But this won't help anyway as the core clears drvdata after the driver left. Set the platform device parent instead. Signed-off-by: Jan Kiszka Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij Acked-by: Greg Kroah-Hartman --- drivers/gpio/gpio-exar.c | 2 +- drivers/tty/serial/8250/8250_exar.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c index 006a9a67c2a4..da4550bb9939 100644 --- a/drivers/gpio/gpio-exar.c +++ b/drivers/gpio/gpio-exar.c @@ -119,7 +119,7 @@ static int exar_direction_input(struct gpio_chip *chip, unsigned int offset) static int gpio_exar_probe(struct platform_device *pdev) { - struct pci_dev *pcidev = platform_get_drvdata(pdev); + struct pci_dev *pcidev = to_pci_dev(pdev->dev.parent); struct exar_gpio_chip *exar_gpio; void __iomem *p; int index, ret; diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index c29c7e675890..0f4b236d7e68 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -203,7 +203,8 @@ xr17v35x_register_gpio(struct pci_dev *pcidev) if (!pdev) return NULL; - platform_set_drvdata(pdev, pcidev); + pdev->dev.parent = &pcidev->dev; + if (platform_device_add(pdev) < 0) { platform_device_put(pdev); return NULL; -- 2.12.3