2018-09-12 14:46:33

by Alan Tull

[permalink] [raw]
Subject: [PATCH 0/5] fpga: patches for v4.19

Hi Greg,

Please take these five small patches for FPGA. They
have been reviewed on the mailing lists and apply cleanly
on linux-next/master and char-misc-testing.

Thanks,
Alan

Alan Tull (3):
fpga: do not access region struct after fpga_region_unregister
fpga: bridge: fix obvious function documentation error
docs: fpga: document fpga manager flags

Moritz Fischer (2):
fpga: of-fpga-region: Use platform_set_drvdata
fpga: dfl-fme-region: Use platform_get_drvdata()

Documentation/driver-api/fpga/fpga-mgr.rst | 5 +++++
drivers/fpga/dfl-fme-region.c | 6 ++++--
drivers/fpga/fpga-bridge.c | 2 +-
drivers/fpga/of-fpga-region.c | 5 +++--
include/linux/fpga/fpga-mgr.h | 20 ++++++++++++++------
5 files changed, 27 insertions(+), 11 deletions(-)

--
2.7.4



2018-09-12 14:44:16

by Alan Tull

[permalink] [raw]
Subject: [PATCH 4/5] fpga: of-fpga-region: Use platform_set_drvdata

From: Moritz Fischer <[email protected]>

Use platform_set_drvdata rather than dev_set_drvdata
to match the platform_get_drvdata in the _remove()
function of the platform driver.

Signed-off-by: Moritz Fischer <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
drivers/fpga/of-fpga-region.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index 052a134..d6a70e4 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -421,7 +421,7 @@ static int of_fpga_region_probe(struct platform_device *pdev)
goto eprobe_free;

of_platform_populate(np, fpga_region_of_match, NULL, &region->dev);
- dev_set_drvdata(dev, region);
+ platform_set_drvdata(pdev, region);

dev_info(dev, "FPGA Region probed\n");

--
2.7.4


2018-09-12 14:44:21

by Alan Tull

[permalink] [raw]
Subject: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()

From: Moritz Fischer <[email protected]>

Use platform_get_drvdata() in remove() function of
the platform driver rather than dev_get_drvdata()
to match the platform_set_drvdata in the probe().

Signed-off-by: Moritz Fischer <[email protected]>
Acked-by: Alan Tull <[email protected]>
---
drivers/fpga/dfl-fme-region.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
index 51a5ac2..3fa0de2 100644
--- a/drivers/fpga/dfl-fme-region.c
+++ b/drivers/fpga/dfl-fme-region.c
@@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)

static int fme_region_remove(struct platform_device *pdev)
{
- struct fpga_region *region = dev_get_drvdata(&pdev->dev);
+ struct fpga_region *region = platform_get_drvdata(pdev);
struct fpga_manager *mgr = region->mgr;

fpga_region_unregister(region);
--
2.7.4


2018-09-12 14:44:41

by Alan Tull

[permalink] [raw]
Subject: [PATCH 2/5] fpga: bridge: fix obvious function documentation error

fpga_bridge_dev_match() returns a FPGA bridge struct, not a
FPGA manager struct so s/manager/bridge/.

Signed-off-by: Alan Tull <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
---
drivers/fpga/fpga-bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 24b8f98..c983dac 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -125,7 +125,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)
*
* Given a device, get an exclusive reference to a fpga bridge.
*
- * Return: fpga manager struct or IS_ERR() condition containing error code.
+ * Return: fpga bridge struct or IS_ERR() condition containing error code.
*/
struct fpga_bridge *fpga_bridge_get(struct device *dev,
struct fpga_image_info *info)
--
2.7.4


2018-09-12 14:45:43

by Alan Tull

[permalink] [raw]
Subject: [PATCH 3/5] docs: fpga: document fpga manager flags

Add flags #defines to kerneldoc documentation in a
useful place.

Signed-off-by: Alan Tull <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
---
Documentation/driver-api/fpga/fpga-mgr.rst | 5 +++++
include/linux/fpga/fpga-mgr.h | 20 ++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/Documentation/driver-api/fpga/fpga-mgr.rst b/Documentation/driver-api/fpga/fpga-mgr.rst
index 4b3825d..82b6dbb 100644
--- a/Documentation/driver-api/fpga/fpga-mgr.rst
+++ b/Documentation/driver-api/fpga/fpga-mgr.rst
@@ -184,6 +184,11 @@ API for implementing a new FPGA Manager driver
API for programming an FPGA
---------------------------

+FPGA Manager flags
+
+.. kernel-doc:: include/linux/fpga/fpga-mgr.h
+ :doc: FPGA Manager flags
+
.. kernel-doc:: include/linux/fpga/fpga-mgr.h
:functions: fpga_image_info

diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index 8942e61..8ab5df7 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -53,12 +53,20 @@ enum fpga_mgr_states {
FPGA_MGR_STATE_OPERATING,
};

-/*
- * FPGA Manager flags
- * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
- * FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
- * FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
- * FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
+/**
+ * DOC: FPGA Manager flags
+ *
+ * Flags used in the &fpga_image_info->flags field
+ *
+ * %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
+ *
+ * %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting
+ *
+ * %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted
+ *
+ * %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first
+ *
+ * %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed
*/
#define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
#define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
--
2.7.4


2018-09-12 14:46:19

by Alan Tull

[permalink] [raw]
Subject: [PATCH 1/5] fpga: do not access region struct after fpga_region_unregister

A couple drivers were accessing the region struct after it had been
freed. Save off the pointer to the mgr before the region struct gets
freed.

Signed-off-by: Alan Tull <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
---
drivers/fpga/dfl-fme-region.c | 4 +++-
drivers/fpga/of-fpga-region.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
index 0b7e19c..51a5ac2 100644
--- a/drivers/fpga/dfl-fme-region.c
+++ b/drivers/fpga/dfl-fme-region.c
@@ -14,6 +14,7 @@
*/

#include <linux/module.h>
+#include <linux/fpga/fpga-mgr.h>
#include <linux/fpga/fpga-region.h>

#include "dfl-fme-pr.h"
@@ -66,9 +67,10 @@ static int fme_region_probe(struct platform_device *pdev)
static int fme_region_remove(struct platform_device *pdev)
{
struct fpga_region *region = dev_get_drvdata(&pdev->dev);
+ struct fpga_manager *mgr = region->mgr;

fpga_region_unregister(region);
- fpga_mgr_put(region->mgr);
+ fpga_mgr_put(mgr);

return 0;
}
diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index 35fabb8..052a134 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -437,9 +437,10 @@ static int of_fpga_region_probe(struct platform_device *pdev)
static int of_fpga_region_remove(struct platform_device *pdev)
{
struct fpga_region *region = platform_get_drvdata(pdev);
+ struct fpga_manager *mgr = region->mgr;

fpga_region_unregister(region);
- fpga_mgr_put(region->mgr);
+ fpga_mgr_put(mgr);

return 0;
}
--
2.7.4


2018-09-30 15:49:06

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()

On Wed, Sep 12, 2018 at 09:43:27AM -0500, Alan Tull wrote:
> From: Moritz Fischer <[email protected]>
>
> Use platform_get_drvdata() in remove() function of
> the platform driver rather than dev_get_drvdata()
> to match the platform_set_drvdata in the probe().
>
> Signed-off-by: Moritz Fischer <[email protected]>
> Acked-by: Alan Tull <[email protected]>
> ---
> drivers/fpga/dfl-fme-region.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
> index 51a5ac2..3fa0de2 100644
> --- a/drivers/fpga/dfl-fme-region.c
> +++ b/drivers/fpga/dfl-fme-region.c
> @@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
>
> static int fme_region_remove(struct platform_device *pdev)
> {
> - struct fpga_region *region = dev_get_drvdata(&pdev->dev);
> + struct fpga_region *region = platform_get_drvdata(pdev);

This is nice, but not a bugfix. I'll wait for 4.20-rc1 for this patch.

thanks,

greg k-h

2018-09-30 15:50:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4/5] fpga: of-fpga-region: Use platform_set_drvdata

On Wed, Sep 12, 2018 at 09:43:26AM -0500, Alan Tull wrote:
> From: Moritz Fischer <[email protected]>
>
> Use platform_set_drvdata rather than dev_set_drvdata
> to match the platform_get_drvdata in the _remove()
> function of the platform driver.
>
> Signed-off-by: Moritz Fischer <[email protected]>
> Acked-by: Alan Tull <[email protected]>
> ---
> drivers/fpga/of-fpga-region.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
> index 052a134..d6a70e4 100644
> --- a/drivers/fpga/of-fpga-region.c
> +++ b/drivers/fpga/of-fpga-region.c
> @@ -421,7 +421,7 @@ static int of_fpga_region_probe(struct platform_device *pdev)
> goto eprobe_free;
>
> of_platform_populate(np, fpga_region_of_match, NULL, &region->dev);
> - dev_set_drvdata(dev, region);
> + platform_set_drvdata(pdev, region);

Again, not really a bugfix :)

2018-11-12 15:48:13

by Alan Tull

[permalink] [raw]
Subject: Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()

On Sun, Sep 30, 2018 at 10:48 AM Greg Kroah-Hartman
<[email protected]> wrote:

Hi Greg,

>
> On Wed, Sep 12, 2018 at 09:43:27AM -0500, Alan Tull wrote:
> > From: Moritz Fischer <[email protected]>
> >
> > Use platform_get_drvdata() in remove() function of
> > the platform driver rather than dev_get_drvdata()
> > to match the platform_set_drvdata in the probe().
> >
> > Signed-off-by: Moritz Fischer <[email protected]>
> > Acked-by: Alan Tull <[email protected]>
> > ---
> > drivers/fpga/dfl-fme-region.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
> > index 51a5ac2..3fa0de2 100644
> > --- a/drivers/fpga/dfl-fme-region.c
> > +++ b/drivers/fpga/dfl-fme-region.c
> > @@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
> >
> > static int fme_region_remove(struct platform_device *pdev)
> > {
> > - struct fpga_region *region = dev_get_drvdata(&pdev->dev);
> > + struct fpga_region *region = platform_get_drvdata(pdev);
>
> This is nice, but not a bugfix. I'll wait for 4.20-rc1 for this patch.

Could you take patch 4/5 and 5/5? They didn't make it into a 4.20 rc yet.

Alan

>
> thanks,
>
> greg k-h

2018-11-12 15:49:50

by Alan Tull

[permalink] [raw]
Subject: Re: [PATCH 4/5] fpga: of-fpga-region: Use platform_set_drvdata

On Sun, Sep 30, 2018 at 10:49 AM Greg Kroah-Hartman
<[email protected]> wrote:

Hi Greg,

>
> On Wed, Sep 12, 2018 at 09:43:26AM -0500, Alan Tull wrote:
> > From: Moritz Fischer <[email protected]>
> >
> > Use platform_set_drvdata rather than dev_set_drvdata
> > to match the platform_get_drvdata in the _remove()
> > function of the platform driver.
> >
> > Signed-off-by: Moritz Fischer <[email protected]>
> > Acked-by: Alan Tull <[email protected]>
> > ---
> > drivers/fpga/of-fpga-region.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
> > index 052a134..d6a70e4 100644
> > --- a/drivers/fpga/of-fpga-region.c
> > +++ b/drivers/fpga/of-fpga-region.c
> > @@ -421,7 +421,7 @@ static int of_fpga_region_probe(struct platform_device *pdev)
> > goto eprobe_free;
> >
> > of_platform_populate(np, fpga_region_of_match, NULL, &region->dev);
> > - dev_set_drvdata(dev, region);
> > + platform_set_drvdata(pdev, region);
>
> Again, not really a bugfix :)

Could you take this patch 4/5 (just sent a reminder for 5/5)?

Thanks
Alan

2018-11-12 18:02:50

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()

On Mon, Nov 12, 2018 at 09:46:53AM -0600, Alan Tull wrote:
> On Sun, Sep 30, 2018 at 10:48 AM Greg Kroah-Hartman
> <[email protected]> wrote:
>
> Hi Greg,
>
> >
> > On Wed, Sep 12, 2018 at 09:43:27AM -0500, Alan Tull wrote:
> > > From: Moritz Fischer <[email protected]>
> > >
> > > Use platform_get_drvdata() in remove() function of
> > > the platform driver rather than dev_get_drvdata()
> > > to match the platform_set_drvdata in the probe().
> > >
> > > Signed-off-by: Moritz Fischer <[email protected]>
> > > Acked-by: Alan Tull <[email protected]>
> > > ---
> > > drivers/fpga/dfl-fme-region.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
> > > index 51a5ac2..3fa0de2 100644
> > > --- a/drivers/fpga/dfl-fme-region.c
> > > +++ b/drivers/fpga/dfl-fme-region.c
> > > @@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
> > >
> > > static int fme_region_remove(struct platform_device *pdev)
> > > {
> > > - struct fpga_region *region = dev_get_drvdata(&pdev->dev);
> > > + struct fpga_region *region = platform_get_drvdata(pdev);
> >
> > This is nice, but not a bugfix. I'll wait for 4.20-rc1 for this patch.
>
> Could you take patch 4/5 and 5/5? They didn't make it into a 4.20 rc yet.

Can you resend them please? I don't see either of these in my queue
anywhere.

thanks,

greg k-h

2018-11-12 19:42:14

by Alan Tull

[permalink] [raw]
Subject: Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()

On Mon, Nov 12, 2018 at 12:02 PM Greg Kroah-Hartman
<[email protected]> wrote:
>
> On Mon, Nov 12, 2018 at 09:46:53AM -0600, Alan Tull wrote:
> > On Sun, Sep 30, 2018 at 10:48 AM Greg Kroah-Hartman
> > <[email protected]> wrote:
> >
> > Hi Greg,
> >
> > >
> > > On Wed, Sep 12, 2018 at 09:43:27AM -0500, Alan Tull wrote:
> > > > From: Moritz Fischer <[email protected]>
> > > >
> > > > Use platform_get_drvdata() in remove() function of
> > > > the platform driver rather than dev_get_drvdata()
> > > > to match the platform_set_drvdata in the probe().
> > > >
> > > > Signed-off-by: Moritz Fischer <[email protected]>
> > > > Acked-by: Alan Tull <[email protected]>
> > > > ---
> > > > drivers/fpga/dfl-fme-region.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c
> > > > index 51a5ac2..3fa0de2 100644
> > > > --- a/drivers/fpga/dfl-fme-region.c
> > > > +++ b/drivers/fpga/dfl-fme-region.c
> > > > @@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
> > > >
> > > > static int fme_region_remove(struct platform_device *pdev)
> > > > {
> > > > - struct fpga_region *region = dev_get_drvdata(&pdev->dev);
> > > > + struct fpga_region *region = platform_get_drvdata(pdev);
> > >
> > > This is nice, but not a bugfix. I'll wait for 4.20-rc1 for this patch.
> >
> > Could you take patch 4/5 and 5/5? They didn't make it into a 4.20 rc yet.
>
> Can you resend them please? I don't see either of these in my queue
> anywhere.
>
> thanks,
>
> greg k-h

Sure! Just sent them.

Thanks,
Alan