spi: xilinx: Massage xilinx_spi.h
Subsystems (2)
cover spi: xilinx: Massage xilinx_spi.h
Fix kernel documentation and inclusion block, and dropping the size of the num_chipselect.
Andy Shevchenko (3):
spi: xilinx: Fix kernel documentation in the xilinx_spi.h
spi: xilinx: Add necessary inclusion and forward declaration
spi: xilinx: Make num_chipselect 8-bit in the struct
xspi_platform_data
include/linux/spi/xilinx_spi.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
PATCH 1/3 spi: xilinx: Fix kernel documentation in the xilinx_spi.h
While updating the data structure layout the kernel documentation became outdated. Synchronize kernel documentation with the actual data structure layout.
--- include/linux/spi/xilinx_spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/spi/xilinx_spi.h +1 -1
@@ -5,10 +5,10 @@/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. -* @little_endian: If registers should be accessed little endian or not. * @bits_per_word: Number of bits per word. * @devices: Devices to add when the driver is probed. * @num_devices: Number of devices in the devices array. +* @force_irq: If set, forces QSPI transaction requirements. */ struct xspi_platform_data {u16 num_chipselect;
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [PATCH v1 1/3] spi: xilinx: Fix kernel documentation in the xilinx_spi.h
Quoted 17 lines · Andy Shevchenko
While updating the data structure layout the kernel documentation became outdated. Synchronize kernel documentation with the actual data structure layout.
Fixes 1dd46599f83a ("spi: xilinx: add force_irq for QSPI mode")Fixes 082339bc63cc ("spi: spi-xilinx: Add run run-time endian detection")Signed-off-by Andy Shevchenko <[email protected]>--- include/linux/spi/xilinx_spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/spi/xilinx_spi.h +0
-0@@ -5,10 +5,10 @@/**
include/linux/spi/xilinx_spi.h line 14
Quoted 10 lines
include/linux/spi/xilinx_spi.h +1
-1* struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. -* @little_endian: If registers should be accessed little endian or not. * @bits_per_word: Number of bits per word. * @devices: Devices to add when the driver is probed. * @num_devices: Number of devices in the devices array. +* @force_irq: If set, forces QSPI transaction requirements. */ struct xspi_platform_data {u16 num_chipselect;
Thanks,
Michal
PATCH 2/3 spi: xilinx: Add necessary inclusion and forward declaration
In reply to Andy Shevchenkoxilinx_spi.h is mnissing inclusion and forward declaration, add them.
--- include/linux/spi/xilinx_spi.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/spi/xilinx_spi.h +4 -0
@@ -2,6 +2,10 @@#ifndef __LINUX_SPI_XILINX_SPI_H#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP.
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Michal Simek
maintainerRe: [PATCH v1 2/3] spi: xilinx: Add necessary inclusion and forward declaration
Quoted 12 lines · Andy Shevchenko
xilinx_spi.his mnissing inclusion and forward declaration, add them.Signed-off-by Andy Shevchenko <[email protected]>--- include/linux/spi/xilinx_spi.h | 4 ++++ 1 file changed, 4 insertions(+)include/linux/spi/xilinx_spi.h +0
-0
include/linux/spi/xilinx_spi.h line 11
Quoted 10 lines
include/linux/spi/xilinx_spi.h +4
-0@@ -2,6 +2,10 @@#ifndef __LINUX_SPI_XILINX_SPI_H#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP.
Likely correct but forget how to check it with tools.
Thanks,
Michal
Re: [PATCH v1 2/3] spi: xilinx: Add necessary inclusion and forward declaration
Quoted 2 lines · Michal Simek
Quoted 1 line · Andy Shevchenko
xilinx_spi.his mnissing inclusion and forward declaration, add them.
...
Quoted 11 lines
include/linux/spi/xilinx_spi.h line 11
Quoted 9 lines
include/linux/spi/xilinx_spi.h +4
-0#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. Likely correct but forget how to check it with tools.
I'm not sure which tools we have to check this.
The types.h is needed for uXX
The forward declaration for the pointer to the mentioned type.
All this has been derived from reading the file.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Michal Simek
maintainerRe: [PATCH v1 2/3] spi: xilinx: Add necessary inclusion and forward declaration
Quoted 18 lines · Andy Shevchenko
Quoted 2 lines · Michal Simek
Quoted 1 line · Andy Shevchenko
xilinx_spi.his mnissing inclusion and forward declaration, add them....
Quoted 11 lines
include/linux/spi/xilinx_spi.h line 11
Quoted 9 lines
include/linux/spi/xilinx_spi.h +4
-0#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. Likely correct but forget how to check it with tools.
Quoted 6 lines
I'm not sure which tools we have to check this.
The
types.his needed for uXX
The forward declaration for the pointer to the mentioned type.All this has been derived from reading the file.
No issue with it. But I am quite sure there was a tool which was able to find it out and report it. But forgot which one was it.
M
Re: [PATCH v1 2/3] spi: xilinx: Add necessary inclusion and forward declaration
Quoted 4 lines · Michal Simek
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Michal Simek
Quoted 1 line · Andy Shevchenko
xilinx_spi.his mnissing inclusion and forward declaration, add them.
...
Quoted 14 lines
Quoted 14 lines
Quoted 11 lines
include/linux/spi/xilinx_spi.h line 11
Quoted 9 lines
include/linux/spi/xilinx_spi.h +4
-0#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. Likely correct but forget how to check it with tools.
I'm not sure which tools we have to check this.
Quoted 7 lines
Quoted 4 lines
The
types.his needed for uXX
The forward declaration for the pointer to the mentioned type.All this has been derived from reading the file.
No issue with it. But I am quite sure there was a tool which was able to find it out and report it. But forgot which one was it.
You mean iwyu? If so, it needs a lot of tuning before being able to be used in Linux kernel.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Michal Simek
maintainerRe: [PATCH v1 2/3] spi: xilinx: Add necessary inclusion and forward declaration
Quoted 25 lines · Andy Shevchenko
Quoted 4 lines · Michal Simek
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Michal Simek
Quoted 1 line · Andy Shevchenko
xilinx_spi.his mnissing inclusion and forward declaration, add them....
Quoted 17 lines
Quoted 17 lines
Quoted 11 lines
include/linux/spi/xilinx_spi.h line 11
Quoted 9 lines
include/linux/spi/xilinx_spi.h +4
-0#define __LINUX_SPI_XILINX_SPI_H +#include <linux/types.h> + +struct spi_board_info ; +/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver * @num_chipselect: Number of chip select by the IP. Likely correct but forget how to check it with tools.
I'm not sure which tools we have to check this.
The
types.his needed for uXX
The forward declaration for the pointer to the mentioned type.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
All this has been derived from reading the file.
No issue with it. But I am quite sure there was a tool which was able to find it out and report it. But forgot which one was it.
You mean iwyu? If so, it needs a lot of tuning before being able to be used in Linux kernel.
Acked-by; Michal Simek <[email protected]>
Thanks,
Michal
PATCH 3/3 spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
In reply to Andy ShevchenkoThere is no use for whole 16-bit for the number of chip select pins. Drop it to 8 bits and reshuffle the data structure layout to avoid unnecessary paddings.
--- include/linux/spi/xilinx_spi.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/linux/spi/xilinx_spi.h +6 -6
@@ -8,18 +8,18 @@ struct spi_board_info;/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver +* @force_irq: If set, forces QSPI transaction requirements. * @num_chipselect: Number of chip select by the IP. * @bits_per_word: Number of bits per word. -* @devices: Devices to add when the driver is probed. * @num_devices: Number of devices in the devices array. -* @force_irq: If set, forces QSPI transaction requirements. +* @devices: Devices to add when the driver is probed. */ struct xspi_platform_data { -u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices; +struct spi_board_info *devices; };#endif /* __LINUX_SPI_XILINX_SPI_H */
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Michal Simek
maintainerRe: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 24 lines · Andy Shevchenko
There is no use for whole 16-bit for the number of chip select pins. Drop it to 8 bits and reshuffle the data structure layout to avoid unnecessary paddings.
Signed-off-by Andy Shevchenko <[email protected]>--- include/linux/spi/xilinx_spi.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)include/linux/spi/xilinx_spi.h +2
-2@@ -8,18 +8,18 @@ struct spi_board_info;/** * struct xspi_platform_data - Platform data of the Xilinx SPI driver +* @force_irq: If set, forces QSPI transaction requirements. * @num_chipselect: Number of chip select by the IP. * @bits_per_word: Number of bits per word. -* @devices: Devices to add when the driver is probed. * @num_devices: Number of devices in the devices array. -* @force_irq: If set, forces QSPI transaction requirements. +* @devices: Devices to add when the driver is probed.
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 10 lines
include/linux/spi/xilinx_spi.h +3
-4*/ struct xspi_platform_data { -u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;
all above have 32bits. It means on 64bit cpu you have 32bit gap here.
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;
It means this should be like this and then there is no gap between on 32bit/64bit systems.
struct xspi_platform_data {
struct spi_board_info * devices; /* 0 8 */ bool force_irq; /* 8 1 */ u8 num_chipselect; /* 9 1 */ u8 bits_per_word; /* 10 1 */ u8 num_devices; /* 11 1 */
/* size: 16, cachelines: 1, members: 5 */ /* padding: 4 */ /* last cacheline: 16 bytes */ };
Thanks,
Michal
Re: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 12 lines
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 9 lines
struct xspi_platform_data {include/linux/spi/xilinx_spi.h +3
-4-u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 1 line
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;
On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
Quoted 14 lines
It means this should be like this and then there is no gap between on 32bit/64bit systems.
struct
xspi_platform_data{struct spi_board_info * devices; /* 0 8 */ bool force_irq; /* 8 1 */ u8 num_chipselect; /* 9 1 */ u8 bits_per_word; /* 10 1 */ u8 num_devices; /* 11 1 *//* size: 16, cachelines: 1, members: 5 */ /* padding: 4 */ /* last cacheline: 16 bytes */ };
Signature · 2 lines
With Best Regards, Andy Shevchenko
Michal Simek
maintainerRe: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 17 lines · Andy Shevchenko
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 11 lines
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 9 lines
struct xspi_platform_data {include/linux/spi/xilinx_spi.h +3
-4-u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 5 lines
Quoted 1 line
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
I am not able to tell if toolchain enforce 8byte alignment by default/by setup on all 64bit systems. I am using pahole to check this which was recommended by Greg in past which reports gap in the middle.
thanks,
Michal
Re: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 3 lines · Michal Simek
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 9 lines
struct xspi_platform_data {include/linux/spi/xilinx_spi.h +3
-4-u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 5 lines
Quoted 1 line
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
Quoted 4 lines
I am not able to tell if toolchain enforce 8byte alignment by default/by setup on all 64bit systems.
I am using pahole to check this which was recommended by Greg in past which reports gap in the middle.
I see, thanks for explanation.
Yes, it's likely that in some cases it will be a gap on 64-bit platforms, but after this patch no gap on 32-bit. Do you still want me to reshuffle that as you suggested?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Michal Simek
maintainerRe: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 30 lines · Andy Shevchenko
Quoted 3 lines · Michal Simek
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 9 lines
struct xspi_platform_data {include/linux/spi/xilinx_spi.h +3
-4-u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 5 lines
Quoted 1 line
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
Quoted 4 lines
I am not able to tell if toolchain enforce 8byte alignment by default/by setup on all 64bit systems.
I am using pahole to check this which was recommended by Greg in past which reports gap in the middle.
Quoted 5 lines
I see, thanks for explanation.
Yes, it's likely that in some cases it will be a gap on 64-bit platforms, but after this patch no gap on 32-bit. Do you still want me to reshuffle that as you suggested?
Yes I would prefer to do that change when you are doing cleanup.
M
Re: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 5 lines · Michal Simek
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Michal Simek
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 12 lines
Quoted 11 lines
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 21
Quoted 9 lines
struct xspi_platform_data {include/linux/spi/xilinx_spi.h +3
-4-u16 num_chipselect; -u8 bits_per_word; -struct spi_board_info *devices; -u8 num_devices;bool force_irq; +u8 num_chipselect; +u8 bits_per_word; +u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 5 lines
Quoted 1 line
include/linux/spi/xilinx_spi.h struct spi_board_info; · line 22
Quoted 1 line
include/linux/spi/xilinx_spi.h +1
-0+struct spi_board_info *devices;On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
I am not able to tell if toolchain enforce 8byte alignment by default/by setup on all 64bit systems.
I am using pahole to check this which was recommended by Greg in past which reports gap in the middle.
Quoted 7 lines
Quoted 5 lines
I see, thanks for explanation.
Yes, it's likely that in some cases it will be a gap on 64-bit platforms, but after this patch no gap on 32-bit. Do you still want me to reshuffle that as you suggested?
Yes I would prefer to do that change when you are doing cleanup.
Can you give your tag? Then I prepare a new version with addressed comments against last patch.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1 3/3] spi: xilinx: Make num_chipselect 8-bit in the struct xspi_platform_data
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Michal Simek
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Michal Simek
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Michal Simek
On 3/7/24 16:43, Andy Shevchenko wrote:
...
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 18 lines
Quoted 12 lines
Quoted 11 lines
Review
Quoted 9 lines
struct xspi_platform_data {(quoted diff) +3
-4- u16 num_chipselect; - u8 bits_per_word; - struct spi_board_info *devices; - u8 num_devices; bool force_irq; + u8 num_chipselect; + u8 bits_per_word; + u8 num_devices;all above have 32bits. It means on 64bit cpu you have 32bit gap here.
Quoted 5 lines
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +1
-0+ struct spi_board_info *devices;On all architectures? I mean do all 64-bit architecture ABIs _require_ the pointer to be aligned at 8-byte boundary? Even if so, the struct itself can be aligned on 4-byte boundary.
Quoted 4 lines
I am not able to tell if toolchain enforce 8byte alignment by default/by setup on all 64bit systems.
I am using pahole to check this which was recommended by Greg in past which reports gap in the middle.I see, thanks for explanation.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yes, it's likely that in some cases it will be a gap on 64-bit platforms, but after this patch no gap on 32-bit. Do you still want me to reshuffle that as you suggested?
Yes I would prefer to do that change when you are doing cleanup.
Can you give your tag?
I mean for the other patch, not this one :-)
Quoted 2 lines
Then I prepare a new version with addressed comments against last patch.
Signature · 2 lines
With Best Regards, Andy Shevchenko