mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Jan Kiszka <jan.kiszka@siemens.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>,
	Sascha Weisenberger <sascha.weisenberger@siemens.com>
Subject: Re: [PATCH 2/8] gpio: exar: Fix passing in of parent PCI device
Date: Sun, 14 May 2017 10:11:13 +0200	[thread overview]
Message-ID: <4a38292e-3340-dfb4-8a61-114fccf42958@web.de> (raw)
In-Reply-To: <CAHp75VfCd4feKeHOe4QMM88nMQ5wnP4yk7iDJMXN7LcygXVObw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2326 bytes --]

On 2017-05-13 15:25, Andy Shevchenko wrote:
> On Sat, May 13, 2017 at 10:29 AM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> This fixes reloading of the driver for the same device: 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.
>>
>> Use stable platform_data instead.
> 
>>From the above I didn't clearly get what device you are talking about.
> GPIO?

"This fixes reloading of the GPIO driver for the same platform device
instance as created by the exar UART driver: [...]"

Clearer?

> 
> Can you provide step by step what you did and what bug you got?

Obviously a NULL pointer: Just rmmod gpio-exar and reload it while there
is the same platform device present.

> 
> Regarding below it looks to me a bit hackish.

The alternative is a classic platform data structure, then also carrying
the properties of patch 7 - which are, BTW, not DT-related, thus shall
not form an external interface. Probably another reason to switch
everything to some struct exar_gpio_platform_data.

Jan

> 
>>  static int gpio_exar_probe(struct platform_device *pdev)
>>  {
>> -       struct pci_dev *pcidev = platform_get_drvdata(pdev);
>> +       struct pci_dev *pcidev = *(struct pci_dev **)pdev->dev.platform_data;
>>         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 b4fa585156c7..2d056d1eeca3 100644
>> --- a/drivers/tty/serial/8250/8250_exar.c
>> +++ b/drivers/tty/serial/8250/8250_exar.c
>> @@ -196,8 +196,12 @@ xr17v35x_register_gpio(struct pci_dev *pcidev)
>>         if (!pdev)
>>                 return NULL;
>>
>> -       platform_set_drvdata(pdev, pcidev);
>> -       if (platform_device_add(pdev) < 0) {
>> +       /*
>> +        * platform_device_add_data kmemdups the data, therefore we can safely
>> +        * pass a stack reference.
>> +        */
>> +       if (platform_device_add_data(pdev, &pcidev, sizeof(pcidev)) < 0 ||
>> +           platform_device_add(pdev) < 0) {
>>                 platform_device_put(pdev);
>>                 return NULL;
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2017-05-14  8:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13  7:28 [PATCH 0/8] serial/gpio: exar: Fixes and support for IOT2000 Jan Kiszka
2017-05-13  7:28 ` [PATCH 1/8] serial: exar: Preconfigure xr17v35x MPIOs as output Jan Kiszka
2017-05-22 15:38   ` Linus Walleij
2017-05-26 13:04   ` Jan Kiszka
2017-05-26 14:22     ` Andy Shevchenko
2017-05-26 18:38     ` Greg Kroah-Hartman
2017-05-13  7:29 ` [PATCH 2/8] gpio: exar: Fix passing in of parent PCI device Jan Kiszka
2017-05-13 13:25   ` Andy Shevchenko
2017-05-14  8:11     ` Jan Kiszka [this message]
2017-05-13  7:29 ` [PATCH 3/8] gpio: exar: Allocate resources on behalf of the platform device Jan Kiszka
2017-05-13 13:26   ` Andy Shevchenko
2017-05-22 15:39   ` Linus Walleij
2017-05-13  7:29 ` [PATCH 4/8] gpio: exar: Fix iomap request Jan Kiszka
2017-05-13 13:28   ` Andy Shevchenko
2017-05-13  7:29 ` [PATCH 5/8] gpio: exar: Fix reading of directions and values Jan Kiszka
2017-05-13 13:36   ` Andy Shevchenko
2017-05-18  5:20     ` Jan Kiszka
2017-05-18 10:11       ` Andy Shevchenko
2017-05-18 10:16         ` Jan Kiszka
2017-05-18 10:23           ` Andy Shevchenko
2017-05-18 10:28             ` Jan Kiszka
2017-05-13  7:29 ` [PATCH 6/8] serial: uapi: Add support for bus termination Jan Kiszka
2017-05-13  7:29 ` [PATCH 7/8] gpio-exar/8250-exar: Make set of exported GPIOs configurable Jan Kiszka
2017-05-13 13:50   ` Andy Shevchenko
2017-05-13  7:29 ` [PATCH 8/8] serial: exar: Add support for IOT2040 device Jan Kiszka
2017-05-13 13:54   ` Andy Shevchenko
2017-05-18  5:06     ` Jan Kiszka
2017-05-18 10:17       ` Andy Shevchenko
2017-05-18 10:37         ` Jan Kiszka
2017-05-18 10:56           ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a38292e-3340-dfb4-8a61-114fccf42958@web.de \
    --to=jan.kiszka@web.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jan.kiszka@siemens.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sascha.weisenberger@siemens.com \
    --cc=sudip.mukherjee@codethink.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome