fpga: patches for v4.19
Subsystems (3)
cover 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(-)
Signature · 1 line
2.7.4
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.
--- drivers/fpga/dfl-fme-region.c | 4 +++- drivers/fpga/of-fpga-region.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/fpga/dfl-fme-region.c +3 -1
@@ -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 ; }
drivers/fpga/of-fpga-region.c +2 -1
@@ -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 ; }
Signature · 1 line
2.7.4
PATCH 2/5 fpga: bridge: fix obvious function documentation error
In reply to Alan Tullfpga_bridge_dev_match() returns a FPGA bridge struct, not a FPGA manager struct so s/manager/bridge/.
--- drivers/fpga/fpga-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/fpga-bridge.c +1 -1
@@ -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)
Signature · 1 line
2.7.4
PATCH 3/5 docs: fpga: document fpga manager flags
In reply to Alan TullAdd flags #defines to kerneldoc documentation in a useful place.
--- Documentation/driver-api/fpga/fpga-mgr.rst | 5 +++++ include/linux/fpga/fpga-mgr.h | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-)
Documentation/driver-api/fpga/fpga-mgr.rst +5 -0
@@ -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
include/linux/fpga/fpga-mgr.h +14 -6
@@ -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)
Signature · 1 line
2.7.4
PATCH 4/5 fpga: of-fpga-region: Use platform_set_drvdata
In reply to Alan TullFrom: 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.
--- drivers/fpga/of-fpga-region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/of-fpga-region.c +1 -1
@@ -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 , ®ion->dev); -dev_set_drvdata (dev, region); +platform_set_drvdata (pdev, region);dev_info (dev,"FPGA Region probed\n" );
Signature · 1 line
2.7.4
Re: [PATCH 4/5] fpga: of-fpga-region: Use platform_set_drvdata
Quoted 17 lines · Alan Tull
From: Moritz Fischer <[email protected]>
Use
platform_set_drvdatarather thandev_set_drvdatato match theplatform_get_drvdatain 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(-)drivers/fpga/of-fpga-region.c +0
-0
drivers/fpga/of-fpga-region.c static int of_fpga_region_probe(struct platform_device *pdev) · line 424
Quoted 5 lines
drivers/fpga/of-fpga-region.c +1
-1@@ -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 , ®ion->dev); -dev_set_drvdata (dev, region); +platform_set_drvdata (pdev, region);
Again, not really a bugfix :)
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,
Quoted 21 lines · Alan Tull
Quoted 19 lines
From: Moritz Fischer <[email protected]>
Use
platform_set_drvdatarather thandev_set_drvdatato match theplatform_get_drvdatain 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(-)drivers/fpga/of-fpga-region.c +0
-0@@ -421,7 +421,7 @@ static int of_fpga_region_probe(struct platform_device *pdev) goto eprobe_free;
Quoted 5 lines
drivers/fpga/of-fpga-region.c static int of_fpga_region_probe(struct platform_device *pdev) · line 424
Quoted 3 lines
drivers/fpga/of-fpga-region.c +1
-1of_platform_populate (np, fpga_region_of_match,NULL , ®ion->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
PATCH 5/5 fpga: dfl-fme-region: Use platform_get_drvdata()
In reply to Alan TullFrom: 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().
--- drivers/fpga/dfl-fme-region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/dfl-fme-region.c +1 -1
@@ -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);
Signature · 1 line
2.7.4
Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()
Quoted 17 lines · Alan Tull
From: Moritz Fischer <[email protected]>
Use
platform_get_drvdata()inremove()function of the platform driver rather thandev_get_drvdata()to match theplatform_set_drvdatain theprobe().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(-)drivers/fpga/dfl-fme-region.c +0
-0
drivers/fpga/dfl-fme-region.c static int fme_region_probe(struct platform_device *pdev) · line 69
Quoted 5 lines
drivers/fpga/dfl-fme-region.c +1
-1@@ -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
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,
Quoted 20 lines · Alan Tull
Quoted 18 lines
From: Moritz Fischer <[email protected]>
Use
platform_get_drvdata()inremove()function of the platform driver rather thandev_get_drvdata()to match theplatform_set_drvdatain theprobe().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(-)drivers/fpga/dfl-fme-region.c +0
-0@@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
Quoted 6 lines
drivers/fpga/dfl-fme-region.c static int fme_region_probe(struct platform_device *pdev) · line 69
Quoted 4 lines
drivers/fpga/dfl-fme-region.c +1
-1static 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
Quoted 4 lines
thanks,
greg k-h
Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()
Quoted 25 lines · Alan Tull
On Sun, Sep 30, 2018 at 10:48 AM Greg Kroah-Hartman <[email protected]> wrote:
Hi Greg,
Quoted 20 lines · Alan Tull
Quoted 18 lines
From: Moritz Fischer <[email protected]>
Use
platform_get_drvdata()inremove()function of the platform driver rather thandev_get_drvdata()to match theplatform_set_drvdatain theprobe().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(-)drivers/fpga/dfl-fme-region.c +0
-0@@ -66,7 +66,7 @@ static int fme_region_probe(struct platform_device *pdev)
Quoted 8 lines
Quoted 6 lines
drivers/fpga/dfl-fme-region.c static int fme_region_probe(struct platform_device *pdev) · line 69
Quoted 4 lines
drivers/fpga/dfl-fme-region.c +1
-1static 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
Re: [PATCH 5/5] fpga: dfl-fme-region: Use platform_get_drvdata()
Quoted 34 lines · Greg Kroah-Hartman
Quoted 32 lines · Alan Tull
On Sun, Sep 30, 2018 at 10:48 AM Greg Kroah-Hartman <[email protected]> wrote:
Hi Greg,
Quoted 26 lines · Alan Tull
Quoted 17 lines
From: Moritz Fischer <[email protected]>
Use
platform_get_drvdata()inremove()function of the platform driver rather thandev_get_drvdata()to match theplatform_set_drvdatain theprobe().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(-)drivers/fpga/dfl-fme-region.c +0
-0drivers/fpga/dfl-fme-region.c static int fme_region_probe(struct platform_device *pdev) · line 69
Quoted 5 lines
drivers/fpga/dfl-fme-region.c +1
-1@@ -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.
Quoted 8 lines
Quoted 1 line
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