Message ID | 20231004183906.97845-1-brgl@bgdev.pl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | spi: bcm2835: add a sentinel at the end of the lookup array | expand |
On Wed, Oct 04, 2023 at 08:39:06PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > GPIOLIB expects the array of lookup entries to be terminated with an > empty member. We need to increase the size of the variable length array > in the lookup table by 1. Right and seems we (used to?) have the same mistake spread over the kernel. Perhaps a helper at some point? Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
On Thu, Oct 5, 2023 at 11:10 AM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Wed, Oct 04, 2023 at 08:39:06PM +0200, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > > > GPIOLIB expects the array of lookup entries to be terminated with an > > empty member. We need to increase the size of the variable length array > > in the lookup table by 1. > > Right and seems we (used to?) have the same mistake spread over the kernel. Almost all lookup tables are static and have a sentinel appended. The temporary lookup hack is only used here and in the int3472 driver AFAIK so it's not that bad. > Perhaps a helper at some point? > I don't want to make it a habit for people. This is still a hack, just less bad than what was here before. So I don't think we need a helper here. Bart > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > -- > With Best Regards, > Andy Shevchenko > >
On Wed, Oct 4, 2023 at 8:39 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> > > GPIOLIB expects the array of lookup entries to be terminated with an > empty member. We need to increase the size of the variable length array > in the lookup table by 1. > > Fixes: 21f252cd29f0 ("spi: bcm2835: reduce the abuse of the GPIO API") > Reported-by: Hans de Goede <hdegoede@redhat.com> > Closes: https://lore.kernel.org/lkml/29764d46-8d3d-9794-bbde-d7928a91cbb5@redhat.com/ > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> OK my bad (I think?) Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > GPIOLIB expects the array of lookup entries to be terminated with an > empty member. We need to increase the size of the variable length array > in the lookup table by 1. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: bcm2835: add a sentinel at the end of the lookup array commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
On Tue, Oct 10, 2023 at 8:33 PM Mark Brown <broonie@kernel.org> wrote: > > On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > > GPIOLIB expects the array of lookup entries to be terminated with an > > empty member. We need to increase the size of the variable length array > > in the lookup table by 1. > > > > > > Applied to > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next > > Thanks! > > [1/1] spi: bcm2835: add a sentinel at the end of the lookup array > commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f > > All being well this means that it will be integrated into the linux-next > tree (usually sometime in the next 24 hours) and sent to Linus during > the next merge window (or sooner if it is a bug fix), however if > problems are discovered then the patch may be dropped or reverted. > > You may get further e-mails resulting from automated or manual testing > and review of the tree, please engage with people reporting problems and > send followup patches addressing any issues that are reported if needed. > > If any updates are required or you are submitting further changes they > should be sent as incremental updates against current git, existing > patches will not be replaced. > > Please add any relevant lists and maintainers to the CCs when replying > to this mail. > > Thanks, > Mark > Mark, Can you provide me with an immutable branch containing commit 21f252cd29f08892d48739fd7513ad79c1cff96a (the one this one fixes)? We are very close to removing gpiochip_find() from the GPIOLIB and with this pulled we could remove it for v6.7. Bart
On Wed, Oct 11, 2023 at 09:36:19AM +0200, Bartosz Golaszewski wrote: > On Tue, Oct 10, 2023 at 8:33 PM Mark Brown <broonie@kernel.org> wrote: > > On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > > [1/1] spi: bcm2835: add a sentinel at the end of the lookup array > > commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f > Can you provide me with an immutable branch containing commit > 21f252cd29f08892d48739fd7513ad79c1cff96a (the one this one fixes)? > We are very close to removing gpiochip_find() from the GPIOLIB and > with this pulled we could remove it for v6.7. Ugh, *please* say this sort of thing when sending patches rather than waiting until after they've been applied. The default is just to add patches to the normal development branches which means they have the whole history for the release cycle after them and may well have other things applied on top of them before you get round to asking for them to be applied on a different branch as is the case here.
On Wed, Oct 11, 2023 at 1:45 PM Mark Brown <broonie@kernel.org> wrote: > > On Wed, Oct 11, 2023 at 09:36:19AM +0200, Bartosz Golaszewski wrote: > > On Tue, Oct 10, 2023 at 8:33 PM Mark Brown <broonie@kernel.org> wrote: > > > On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > > > > [1/1] spi: bcm2835: add a sentinel at the end of the lookup array > > > commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f > > > Can you provide me with an immutable branch containing commit > > 21f252cd29f08892d48739fd7513ad79c1cff96a (the one this one fixes)? > > > We are very close to removing gpiochip_find() from the GPIOLIB and > > with this pulled we could remove it for v6.7. > > Ugh, *please* say this sort of thing when sending patches rather than > waiting until after they've been applied. The default is just to add > patches to the normal development branches which means they have the > whole history for the release cycle after them and may well have other > things applied on top of them before you get round to asking for them to > be applied on a different branch as is the case here. I'm sorry. I didn't expect the removal process to go as fast as there were quite a few users but it turned out to be almost ready now. We can wait until rc7 when your for-next branch will be more or less immutable and then you can tag 21f252cd29f08892d48739fd7513ad79c1cff96a alone (it only has a few commits between it and v6.6-rc1) if that works for you? Bart
On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > GPIOLIB expects the array of lookup entries to be terminated with an > empty member. We need to increase the size of the variable length array > in the lookup table by 1. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: bcm2835: add a sentinel at the end of the lookup array commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
On Wed, Oct 11, 2023 at 1:52 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > On Wed, Oct 11, 2023 at 1:45 PM Mark Brown <broonie@kernel.org> wrote: > > > > On Wed, Oct 11, 2023 at 09:36:19AM +0200, Bartosz Golaszewski wrote: > > > On Tue, Oct 10, 2023 at 8:33 PM Mark Brown <broonie@kernel.org> wrote: > > > > On Wed, 04 Oct 2023 20:39:06 +0200, Bartosz Golaszewski wrote: > > > > > > [1/1] spi: bcm2835: add a sentinel at the end of the lookup array > > > > commit: 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f > > > > > Can you provide me with an immutable branch containing commit > > > 21f252cd29f08892d48739fd7513ad79c1cff96a (the one this one fixes)? > > > > > We are very close to removing gpiochip_find() from the GPIOLIB and > > > with this pulled we could remove it for v6.7. > > > > Ugh, *please* say this sort of thing when sending patches rather than > > waiting until after they've been applied. The default is just to add > > patches to the normal development branches which means they have the > > whole history for the release cycle after them and may well have other > > things applied on top of them before you get round to asking for them to > > be applied on a different branch as is the case here. > > I'm sorry. I didn't expect the removal process to go as fast as there > were quite a few users but it turned out to be almost ready now. > > We can wait until rc7 when your for-next branch will be more or less > immutable and then you can tag > 21f252cd29f08892d48739fd7513ad79c1cff96a alone (it only has a few > commits between it and v6.6-rc1) if that works for you? > > Bart Alternatively - if you send your SPI PR to Linus early in the merge window, I will send the patch removing gpiochip_find() later on top of it? Bart
On Thu, Oct 12, 2023 at 10:40:53AM +0200, Bartosz Golaszewski wrote: > On Wed, Oct 11, 2023 at 1:52 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote: > > I'm sorry. I didn't expect the removal process to go as fast as there > > were quite a few users but it turned out to be almost ready now. > > We can wait until rc7 when your for-next branch will be more or less > > immutable and then you can tag > > 21f252cd29f08892d48739fd7513ad79c1cff96a alone (it only has a few > > commits between it and v6.6-rc1) if that works for you? I spent some time yesterday looking at pulling out a branch but there's other dependencies way back in the history so that's probably not going to work well. > Alternatively - if you send your SPI PR to Linus early in the merge > window, I will send the patch removing gpiochip_find() later on top of > it? I tend to send all my PRs the morning the merge window opens so that'd not be a problem. If I send you a PR at -rc7 you'd realistically want to wait until that was merged before sending yours anyway.
On Thu, Oct 12, 2023 at 10:40:53AM +0200, Bartosz Golaszewski wrote: > Alternatively - if you send your SPI PR to Linus early in the merge > window, I will send the patch removing gpiochip_find() later on top of > it? The following changes since commit 0bb80ecc33a8fb5a682236443c1e740d5c917d1d: Linux 6.6-rc1 (2023-09-10 16:28:41 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git tags/spi-bcm2835-sentinel for you to fetch changes up to 9aaa25df9b02bfe5579cbc9b4cc1177c662ec33f: spi: bcm2835: add a sentinel at the end of the lookup array (2023-10-10 13:12:11 +0100) ---------------------------------------------------------------- spi: Share current state with GPIO tree This is the current state of the SPI tree, shared with the GPIO tree in order to facilitate some treewide improvements there. Unfortunaetly the desire for this treewide work was realised after all the SPI patches had been applied and there were further dependencies with similar issues that caused issues trying to pull things out into a minimal branch. It's expected that this will be merged into Linus' tree as part of the full SPI pull request before the GPIO changes go in. ---------------------------------------------------------------- Andy Shevchenko (3): spidev: Decrease indentation level in spidev_ioctl() SPI_IOC_RD_MODE* spidev: Switch to use spi_get_csgpiod() spidev: Simplify SPI_IOC_RD_MODE* cases in spidev_ioctl() Bartosz Golaszewski (2): spi: bcm2835: reduce the abuse of the GPIO API spi: bcm2835: add a sentinel at the end of the lookup array Christophe JAILLET (1): spi: at91-usart: Remove some dead code Dhruva Gole (2): spi: spi-cadence-quadspi: add runtime pm support spi: spi-cadence-quadspi: Fix missing unwind goto warnings Geert Uytterhoeven (1): spi: mpc52xx-psc: Make mpc52xx_psc_spi_transfer_one_message() static Greg Kroah-Hartman (1): spi: spidev: make spidev_class constant Kees Cook (1): spi: mchp-pci1xxxx: Annotate struct pci1xxxx_spi with __counted_by Li Zetao (25): spi: ar934x: Use helper function devm_clk_get_enabled() spi: armada-3700: Use helper function devm_clk_get_prepared() spi: aspeed: Use helper function devm_clk_get_enabled() spi: ath79: Use helper function devm_clk_get_enabled() spi: spi-axi-spi-engine: Use helper function devm_clk_get_enabled() spi: bcm2835: Use helper function devm_clk_get_enabled() spi: bcm2835aux: Use helper function devm_clk_get_enabled() spi: spi-cadence: Use helper function devm_clk_get_enabled() spi: spi-cavium-thunderx: Use helper function devm_clk_get_enabled() spi: davinci: Use helper function devm_clk_get_enabled() spi: dw-bt1: Use helper function devm_clk_get_enabled() spi: dw-mmio: Use helper function devm_clk_get_*() spi: spi-fsl-dspi: Use helper function devm_clk_get_enabled() spi: lantiq-ssc: Use helper function devm_clk_get_enabled() spi: meson-spicc: Use helper function devm_clk_get_enabled() spi: spi-meson-spifc: Use helper function devm_clk_get_enabled() spi: microchip-core-qspi: Use helper function devm_clk_get_enabled() spi: microchip-core: Use helper function devm_clk_get_enabled() spi: mtk-snfi: Use helper function devm_clk_get_enabled() spi: npcm-fiu: Use helper function devm_clk_get_enabled() spi: orion: Use helper function devm_clk_get_enabled() spi: pic32-sqi: Use helper function devm_clk_get_enabled() spi: pic32: Use helper function devm_clk_get_enabled() spi: spl022: Use helper function devm_clk_get_enabled() spi: rockchip: Use helper function devm_clk_get_enabled() Mark Brown (6): spi: sun6i: fix RX data corruption in DMA mode Merge existing fixes from spi/for-6.6 into new branch spidev: A few cleanups spi: switch to use modern name (part3) spi: Use devm_clk_get_*() helper function to spi: qup: Allow scaling power domains and Rob Herring (3): spi: dt-bindings: arm,pl022: Move child node properties to separate schema spi: dt-bindings: st,stm32-spi: Move "st,spi-midi-ns" to spi-peripheral-props.yaml spi: dt-bindings: Make "additionalProperties: true" explicit Stephan Gerhold (4): spi: dt-bindings: qup: Document power-domains and OPP spi: qup: Parse OPP table for DVFS support spi: dt-bindings: qup: Document interconnects spi: qup: Vote for interconnect bandwidth to DRAM Uwe Kleine-König (1): spi: Drop warning from spi_stop_queue() Vaishnav Achath (1): spi: omap2-mcspi: Fix hardcoded reference clock Vijaya Krishna Nivarthi (1): spi: spi-geni-qcom: Rename the label unmap_if_dma Yang Yingliang (21): spi: lm70llp: switch to use modern name spi: lp-8841: switch to use modern name spi: meson-spicc: switch to use modern name spi: meson-spifc: switch to use modern name spi: microchip-core-qspi: switch to use modern name spi: microchip-core: switch to use modern name spi: mpc512x-psc: switch to use modern name spi: mpc52xx-psc: switch to use modern name spi: mpc52xx: switch to use modern name spi: mt65xx: switch to use modern name spi: mt7621: switch to use modern name spi: mtk-nor: switch to use modern name spi: mtk-snfi: switch to use modern name spi: mux: switch to use spi_alloc_host() spi: mxic: switch to use modern name spi: mxs: switch to use modern name spi: npcm-pspi: switch to use modern name spi: nxp-fspi: switch to use modern name spi: oc-tiny: switch to use modern name spi: omap-uwire: switch to use modern name spi: omap2-mcspi: switch to use modern name Zhang Shurong (1): spi: tegra: Fix missing IRQ check in tegra_slink_probe() .../bindings/spi/allwinner,sun4i-a10-spi.yaml | 2 + .../bindings/spi/allwinner,sun6i-a31-spi.yaml | 2 + .../bindings/spi/arm,pl022-peripheral-props.yaml | 61 +++++ .../bindings/spi/nvidia,tegra210-quad.yaml | 1 + .../devicetree/bindings/spi/qcom,spi-qup.yaml | 13 + .../devicetree/bindings/spi/rockchip-sfc.yaml | 2 + .../devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 + .../bindings/spi/spi-peripheral-props.yaml | 6 + .../devicetree/bindings/spi/spi-pl022.yaml | 51 ---- .../devicetree/bindings/spi/st,stm32-spi.yaml | 20 -- drivers/spi/spi-ar934x.c | 22 +- drivers/spi/spi-armada-3700.c | 23 +- drivers/spi/spi-aspeed-smc.c | 16 +- drivers/spi/spi-at91-usart.c | 22 +- drivers/spi/spi-ath79.c | 11 +- drivers/spi/spi-axi-spi-engine.c | 25 +- drivers/spi/spi-bcm2835.c | 69 +++--- drivers/spi/spi-bcm2835aux.c | 23 +- drivers/spi/spi-cadence-quadspi.c | 45 +++- drivers/spi/spi-cadence.c | 23 +- drivers/spi/spi-cavium-thunderx.c | 8 +- drivers/spi/spi-davinci.c | 11 +- drivers/spi/spi-dw-bt1.c | 23 +- drivers/spi/spi-dw-mmio.c | 31 +-- drivers/spi/spi-fsl-dspi.c | 12 +- drivers/spi/spi-geni-qcom.c | 6 +- drivers/spi/spi-lantiq-ssc.c | 10 +- drivers/spi/spi-lm70llp.c | 20 +- drivers/spi/spi-lp8841-rtc.c | 56 ++--- drivers/spi/spi-meson-spicc.c | 121 ++++------ drivers/spi/spi-meson-spifc.c | 79 +++---- drivers/spi/spi-microchip-core-qspi.c | 39 +-- drivers/spi/spi-microchip-core.c | 83 +++---- drivers/spi/spi-mpc512x-psc.c | 54 ++--- drivers/spi/spi-mpc52xx-psc.c | 38 +-- drivers/spi/spi-mpc52xx.c | 56 ++--- drivers/spi/spi-mt65xx.c | 190 +++++++-------- drivers/spi/spi-mt7621.c | 50 ++-- drivers/spi/spi-mtk-nor.c | 14 +- drivers/spi/spi-mtk-snfi.c | 67 +----- drivers/spi/spi-mux.c | 2 +- drivers/spi/spi-mxic.c | 68 +++--- drivers/spi/spi-mxs.c | 70 +++--- drivers/spi/spi-npcm-fiu.c | 14 +- drivers/spi/spi-npcm-pspi.c | 68 +++--- drivers/spi/spi-nxp-fspi.c | 30 +-- drivers/spi/spi-oc-tiny.c | 30 +-- drivers/spi/spi-omap-uwire.c | 32 +-- drivers/spi/spi-omap2-mcspi.c | 263 +++++++++++---------- drivers/spi/spi-orion.c | 11 +- drivers/spi/spi-pci1xxxx.c | 2 +- drivers/spi/spi-pic32-sqi.c | 27 +-- drivers/spi/spi-pic32.c | 8 +- drivers/spi/spi-pl022.c | 11 +- drivers/spi/spi-qup.c | 50 +++- drivers/spi/spi-rockchip.c | 30 +-- drivers/spi/spi-tegra20-slink.c | 2 + drivers/spi/spi.c | 4 - drivers/spi/spidev.c | 42 ++-- 59 files changed, 969 insertions(+), 1202 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/arm,pl022-peripheral-props.yaml
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index c9078fee3662..e709887eb2a9 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -1299,7 +1299,7 @@ static int bcm2835_spi_setup(struct spi_device *spi) * More on the problem that it addresses: * https://www.spinics.net/lists/linux-gpio/msg36218.html */ - lookup = kzalloc(struct_size(lookup, table, 1), GFP_KERNEL); + lookup = kzalloc(struct_size(lookup, table, 2), GFP_KERNEL); if (!lookup) { ret = -ENOMEM; goto err_cleanup;