2020-11-19 14:55:51

by Alexandru Ardelean

[permalink] [raw]
Subject: [PATCH] uio/uio_pci_generic: remove unneeded pci_set_drvdata()

The pci_get_drvdata() was moved during commit ef84928cff58
("uio/uio_pci_generic: use device-managed function equivalents").

I should have notice that the pci_set_drvdata() requires a
pci_get_drvdata() for it to make sense.

Signed-off-by: Alexandru Ardelean <[email protected]>
---

Apologies for not noticing this sooner.
If this can be squashed into commit ef84928cff58 , then it's also fine.
I've started seeing that there actually more xxx_set_drvdata() leftovers
in the entire kernel, and I pinged the checkpatch crew to add a check
for this.

https://lore.kernel.org/lkml/CA+U=Dspy5+RE9agcLr6eY9DCMa1c5+++0JLeugMMBRXz4YLj1w@mail.gmail.com/T/#u

drivers/uio/uio_pci_generic.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index 1c6c09e1280d..b8e44d16279f 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -101,13 +101,7 @@ static int probe(struct pci_dev *pdev,
"no support for interrupts?\n");
}

- err = devm_uio_register_device(&pdev->dev, &gdev->info);
- if (err)
- return err;
-
- pci_set_drvdata(pdev, gdev);
-
- return 0;
+ return devm_uio_register_device(&pdev->dev, &gdev->info);
}

static struct pci_driver uio_pci_driver = {
--
2.17.1


2020-11-20 15:50:49

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] uio/uio_pci_generic: remove unneeded pci_set_drvdata()

On Thu, Nov 19, 2020 at 04:59:06PM +0200, Alexandru Ardelean wrote:
> The pci_get_drvdata() was moved during commit ef84928cff58
> ("uio/uio_pci_generic: use device-managed function equivalents").
>
> I should have notice that the pci_set_drvdata() requires a
> pci_get_drvdata() for it to make sense.
>
> Signed-off-by: Alexandru Ardelean <[email protected]>
> ---
>
> Apologies for not noticing this sooner.
> If this can be squashed into commit ef84928cff58 , then it's also fine.
> I've started seeing that there actually more xxx_set_drvdata() leftovers
> in the entire kernel, and I pinged the checkpatch crew to add a check
> for this.
>
> https://lore.kernel.org/lkml/CA+U=Dspy5+RE9agcLr6eY9DCMa1c5+++0JLeugMMBRXz4YLj1w@mail.gmail.com/T/#u

I can't squash existing public commits. Can you resend this and add a
"Fixes:" tag to it to show what commit it fixes so we can track this
properly?

thanks,

greg k-h

2020-11-21 08:00:46

by Alexandru Ardelean

[permalink] [raw]
Subject: RE: [PATCH] uio/uio_pci_generic: remove unneeded pci_set_drvdata()



> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Friday, November 20, 2020 5:46 PM
> To: Ardelean, Alexandru <[email protected]>
> Cc: [email protected]
> Subject: Re: [PATCH] uio/uio_pci_generic: remove unneeded pci_set_drvdata()
>
> [External]
>
> On Thu, Nov 19, 2020 at 04:59:06PM +0200, Alexandru Ardelean wrote:
> > The pci_get_drvdata() was moved during commit ef84928cff58
> > ("uio/uio_pci_generic: use device-managed function equivalents").
> >
> > I should have notice that the pci_set_drvdata() requires a
> > pci_get_drvdata() for it to make sense.
> >
> > Signed-off-by: Alexandru Ardelean <[email protected]>
> > ---
> >
> > Apologies for not noticing this sooner.
> > If this can be squashed into commit ef84928cff58 , then it's also fine.
> > I've started seeing that there actually more xxx_set_drvdata()
> > leftovers in the entire kernel, and I pinged the checkpatch crew to
> > add a check for this.
> >
> > https://urldefense.com/v3/__https://lore.kernel.org/lkml/CA*U=Dspy5*RE
> >
> 9agcLr6eY9DCMa1c5**[email protected]/T/*u__;KysrK
> ysj!
> >
> !A3Ni8CS0y2Y!q3fJW4rKvEHQ7BDt1PaK4Cbexv4wbivUKBeDjo7ZwNXYwOLBawA
> Eq1Jaj
> > mhYxftX6DAJpg$
>
> I can't squash existing public commits. Can you resend this and add a "Fixes:"
> tag to it to show what commit it fixes so we can track this properly?
>

Sure, will re-send in the next couple of days.

Thanks
Alex

> thanks,
>
> greg k-h

2020-11-23 14:32:02

by Alexandru Ardelean

[permalink] [raw]
Subject: [PATCH v2] uio/uio_pci_generic: remove unneeded pci_set_drvdata()

The pci_get_drvdata() was moved during commit ef84928cff58
("uio/uio_pci_generic: use device-managed function equivalents").

Storing a private object with pci_set_drvdata() doesn't make sense
since that change, since there is no more pci_get_drvdata() call in the
driver to retrieve the information.

This change removes it.

Fixes: ef84928cff58 ("io/uio_pci_generic: use device-managed function equivalents")
Signed-off-by: Alexandru Ardelean <[email protected]>
---
drivers/uio/uio_pci_generic.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index 1c6c09e1280d..b8e44d16279f 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -101,13 +101,7 @@ static int probe(struct pci_dev *pdev,
"no support for interrupts?\n");
}

- err = devm_uio_register_device(&pdev->dev, &gdev->info);
- if (err)
- return err;
-
- pci_set_drvdata(pdev, gdev);
-
- return 0;
+ return devm_uio_register_device(&pdev->dev, &gdev->info);
}

static struct pci_driver uio_pci_driver = {
--
2.17.1

2020-11-24 19:52:25

by Alexandru Ardelean

[permalink] [raw]
Subject: RE: [PATCH v2] uio/uio_pci_generic: remove unneeded pci_set_drvdata()



> -----Original Message-----
> From: Alexandru Ardelean <[email protected]>
> Sent: Monday, November 23, 2020 4:35 PM
> To: [email protected]; [email protected]
> Cc: [email protected]; [email protected]; Ardelean, Alexandru
> <[email protected]>
> Subject: [PATCH v2] uio/uio_pci_generic: remove unneeded pci_set_drvdata()
>
> The pci_get_drvdata() was moved during commit ef84928cff58
> ("uio/uio_pci_generic: use device-managed function equivalents").
>
> Storing a private object with pci_set_drvdata() doesn't make sense since that
> change, since there is no more pci_get_drvdata() call in the driver to retrieve the
> information.
>
> This change removes it.
>
> Fixes: ef84928cff58 ("io/uio_pci_generic: use device-managed function
> equivalents")
> Signed-off-by: Alexandru Ardelean <[email protected]>
> ---

Forgot the changelog
Apologies.

Changelog v1 -> v2:
* added Fixes tag
* updated commit comment a bit from V1

> drivers/uio/uio_pci_generic.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c index
> 1c6c09e1280d..b8e44d16279f 100644
> --- a/drivers/uio/uio_pci_generic.c
> +++ b/drivers/uio/uio_pci_generic.c
> @@ -101,13 +101,7 @@ static int probe(struct pci_dev *pdev,
> "no support for interrupts?\n");
> }
>
> - err = devm_uio_register_device(&pdev->dev, &gdev->info);
> - if (err)
> - return err;
> -
> - pci_set_drvdata(pdev, gdev);
> -
> - return 0;
> + return devm_uio_register_device(&pdev->dev, &gdev->info);
> }
>
> static struct pci_driver uio_pci_driver = {
> --
> 2.17.1