* [PATCH v1 0/2] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h
@ 2024-03-07 16:07 Andy Shevchenko
2024-03-07 16:07 ` [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko
2024-03-07 16:07 ` [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko
0 siblings, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2024-03-07 16:07 UTC (permalink / raw)
To: Andy Shevchenko, Arnd Bergmann, linux-arm-kernel, linux-kernel,
linux-spi
Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King,
Mark Brown
A couple of cleanups against linux/spi/pxa2xx_spi.h.
Andy Shevchenko (2):
spi: pxa2xx: Kill pxa2xx_set_spi_info()
spi: pxa2xx: Make num_chipselect 8-bit in the struct
pxa2xx_spi_controller
arch/arm/mach-pxa/devices.c | 18 ------------------
arch/arm/mach-pxa/spitz.c | 13 ++++++++++++-
include/linux/spi/pxa2xx_spi.h | 10 +---------
3 files changed, 13 insertions(+), 28 deletions(-)
--
2.43.0.rc1.1.gbec44491f096
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() 2024-03-07 16:07 [PATCH v1 0/2] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko @ 2024-03-07 16:07 ` Andy Shevchenko 2024-03-07 16:30 ` Arnd Bergmann 2024-03-07 16:07 ` [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko 1 sibling, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:07 UTC (permalink / raw) To: Andy Shevchenko, Arnd Bergmann, linux-arm-kernel, linux-kernel, linux-spi Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown There is the only one user of the pxa2xx_set_spi_info(). Unexport it and inline to the actual user. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/arm/mach-pxa/devices.c | 18 ------------------ arch/arm/mach-pxa/spitz.c | 13 ++++++++++++- include/linux/spi/pxa2xx_spi.h | 8 -------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 661b3fc43275..1e4cd502340e 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -7,7 +7,6 @@ #include <linux/clk-provider.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> -#include <linux/spi/pxa2xx_spi.h> #include <linux/platform_data/i2c-pxa.h> #include <linux/soc/pxa/cpu.h> @@ -665,23 +664,6 @@ struct platform_device pxa27x_device_gpio = { .resource = pxa_resource_gpio, }; -/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1. - * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */ -void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info) -{ - struct platform_device *pd; - - pd = platform_device_alloc("pxa2xx-spi", id); - if (pd == NULL) { - printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n", - id); - return; - } - - pd->dev.platform_data = info; - platform_device_add(pd); -} - static struct resource pxa_dma_resource[] = { [0] = { .start = 0x40000000, diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index cc691b199429..70e4623907fa 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -585,6 +585,9 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = { static void __init spitz_spi_init(void) { + struct platform_device *pd; + int id = 2; + if (machine_is_akita()) gpiod_add_lookup_table(&akita_lcdcon_gpio_table); else @@ -592,7 +595,15 @@ static void __init spitz_spi_init(void) gpiod_add_lookup_table(&spitz_ads7846_gpio_table); gpiod_add_lookup_table(&spitz_spi_gpio_table); - pxa2xx_set_spi_info(2, &spitz_spi_info); + + pd = platform_device_alloc("pxa2xx-spi", id); + if (pd == NULL) { + pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); + } else { + pd->dev.platform_data = info; + platform_device_add(pd); + } + spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); } #else diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index ca2cd4e30ead..56aba2f737b1 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h @@ -45,12 +45,4 @@ struct pxa2xx_spi_chip { u32 timeout; }; -#if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP) - -#include <linux/clk.h> - -extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info); - -#endif - #endif /* __LINUX_SPI_PXA2XX_SPI_H */ -- 2.43.0.rc1.1.gbec44491f096 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() 2024-03-07 16:07 ` [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko @ 2024-03-07 16:30 ` Arnd Bergmann 2024-03-07 16:42 ` Andy Shevchenko 0 siblings, 1 reply; 10+ messages in thread From: Arnd Bergmann @ 2024-03-07 16:30 UTC (permalink / raw) To: Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-spi Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: > There is the only one user of the pxa2xx_set_spi_info(). Unexport it > and inline to the actual user. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> I have no idea why you care about this, but it's a nice cleanup, so I'm happy to see this get merged through the spi tree if that helps. Let me know if I should take it through the soc tree instead. > -/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ This comment might still be useful. > @@ -592,7 +595,15 @@ static void __init spitz_spi_init(void) > > gpiod_add_lookup_table(&spitz_ads7846_gpio_table); > gpiod_add_lookup_table(&spitz_spi_gpio_table); > - pxa2xx_set_spi_info(2, &spitz_spi_info); > + > + pd = platform_device_alloc("pxa2xx-spi", id); > + if (pd == NULL) { > + pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); > + } else { > + pd->dev.platform_data = info; > + platform_device_add(pd); > + } > + > spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); I think the normal interface these days would be platform_device_register_data(), which does it all in one step. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() 2024-03-07 16:30 ` Arnd Bergmann @ 2024-03-07 16:42 ` Andy Shevchenko 2024-03-07 16:47 ` Arnd Bergmann 0 siblings, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:42 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, linux-kernel, linux-spi, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 07, 2024 at 05:30:10PM +0100, Arnd Bergmann wrote: > On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: > > There is the only one user of the pxa2xx_set_spi_info(). Unexport it > > and inline to the actual user. > > > I have no idea why you care about this, PXA2xx headers contain a lot of legacy information for pre-OF era. Besides slowing down the builds, this also pollutes an exported namespace on many platforms where it's even not being used! But this is just an ad-hoc clean up, as the main target to me was CS clean up (as per next patch). > but it's a nice cleanup, > so I'm happy to see this get merged through the spi tree if > that helps. Let me know if I should take it through the soc > tree instead. Thank you for the review! ... > > -/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */ > > This comment might still be useful. Okay. ... > > spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); > > I think the normal interface these days would be > platform_device_register_data(), which does it all in one step. I'm not sure how is this related to the SPI board info registration. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() 2024-03-07 16:42 ` Andy Shevchenko @ 2024-03-07 16:47 ` Arnd Bergmann 2024-03-07 16:51 ` Andy Shevchenko 0 siblings, 1 reply; 10+ messages in thread From: Arnd Bergmann @ 2024-03-07 16:47 UTC (permalink / raw) To: Andy Shevchenko Cc: linux-arm-kernel, linux-kernel, linux-spi, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 7, 2024, at 17:42, Andy Shevchenko wrote: > On Thu, Mar 07, 2024 at 05:30:10PM +0100, Arnd Bergmann wrote: >> On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: >> > spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); >> >> I think the normal interface these days would be >> platform_device_register_data(), which does it all in one step. > > I'm not sure how is this related to the SPI board info registration. It's not. What I meant is that you could use platform_device_register_data() instead of the "platform_device_alloc(); platform_data = info; platform_device_add();" sequence. It should be a safe conversion, but it's also fine to stay with the existing version if you are worried about regressions. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() 2024-03-07 16:47 ` Arnd Bergmann @ 2024-03-07 16:51 ` Andy Shevchenko 0 siblings, 0 replies; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:51 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, linux-kernel, linux-spi, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 07, 2024 at 05:47:56PM +0100, Arnd Bergmann wrote: > On Thu, Mar 7, 2024, at 17:42, Andy Shevchenko wrote: > > On Thu, Mar 07, 2024 at 05:30:10PM +0100, Arnd Bergmann wrote: > >> On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: > >> > spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); > >> > >> I think the normal interface these days would be > >> platform_device_register_data(), which does it all in one step. > > > > I'm not sure how is this related to the SPI board info registration. > > It's not. What I meant is that you could use > platform_device_register_data() instead of the > "platform_device_alloc(); platform_data = info; platform_device_add();" > sequence. Ah, thank you for elaboration. > It should be a safe conversion, but it's also fine to stay > with the existing version if you are worried about regressions. Yeah, I prefer not to change it here (as it out of scope of my little cleanup series). -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller 2024-03-07 16:07 [PATCH v1 0/2] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko 2024-03-07 16:07 ` [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko @ 2024-03-07 16:07 ` Andy Shevchenko 2024-03-07 16:37 ` Arnd Bergmann 1 sibling, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:07 UTC (permalink / raw) To: Andy Shevchenko, Arnd Bergmann, linux-arm-kernel, linux-kernel, linux-spi Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown There is no use for whole 16-bit for the number of chip select pins. Drop it to 8 bits. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/spi/pxa2xx_spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index 56aba2f737b1..e5a4a045fb67 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h @@ -17,7 +17,7 @@ struct dma_chan; * (resides in device.platform_data). */ struct pxa2xx_spi_controller { - u16 num_chipselect; + u8 num_chipselect; u8 enable_dma; u8 dma_burst_size; bool is_target; -- 2.43.0.rc1.1.gbec44491f096 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller 2024-03-07 16:07 ` [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko @ 2024-03-07 16:37 ` Arnd Bergmann 2024-03-07 16:53 ` Andy Shevchenko 0 siblings, 1 reply; 10+ messages in thread From: Arnd Bergmann @ 2024-03-07 16:37 UTC (permalink / raw) To: Andy Shevchenko, linux-arm-kernel, linux-kernel, linux-spi Cc: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: > There is no use for whole 16-bit for the number of chip select pins. > Drop it to 8 bits. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> > --- > include/linux/spi/pxa2xx_spi.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h > index 56aba2f737b1..e5a4a045fb67 100644 > --- a/include/linux/spi/pxa2xx_spi.h > +++ b/include/linux/spi/pxa2xx_spi.h > @@ -17,7 +17,7 @@ struct dma_chan; > * (resides in device.platform_data). > */ > struct pxa2xx_spi_controller { > - u16 num_chipselect; > + u8 num_chipselect; > u8 enable_dma; > u8 dma_burst_size; > bool is_target; I wonder if we could just move the entire header to drivers/spi/. The spitz board only fills the num_chipselect field anyway, and that could be derived from the GPIO lookups instead. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller 2024-03-07 16:37 ` Arnd Bergmann @ 2024-03-07 16:53 ` Andy Shevchenko 2024-03-07 16:55 ` Andy Shevchenko 0 siblings, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:53 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, linux-kernel, linux-spi, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 07, 2024 at 05:37:17PM +0100, Arnd Bergmann wrote: > On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: ... > Acked-by: Arnd Bergmann <arnd@arndb.de> Thanks! ... > I wonder if we could just move the entire header to drivers/spi/. > The spitz board only fills the num_chipselect field anyway, > and that could be derived from the GPIO lookups instead. It seems to be used by drivers/soc/pxa/ssp.c. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller 2024-03-07 16:53 ` Andy Shevchenko @ 2024-03-07 16:55 ` Andy Shevchenko 0 siblings, 0 replies; 10+ messages in thread From: Andy Shevchenko @ 2024-03-07 16:55 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, linux-kernel, linux-spi, Daniel Mack, Haojian Zhuang, Robert Jarzmik, Russell King, Mark Brown On Thu, Mar 07, 2024 at 06:53:44PM +0200, Andy Shevchenko wrote: > On Thu, Mar 07, 2024 at 05:37:17PM +0100, Arnd Bergmann wrote: > > On Thu, Mar 7, 2024, at 17:07, Andy Shevchenko wrote: ... > > I wonder if we could just move the entire header to drivers/spi/. > > The spitz board only fills the num_chipselect field anyway, > > and that could be derived from the GPIO lookups instead. > > It seems to be used by drivers/soc/pxa/ssp.c. At closer look it seems a leftover! -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-03-07 16:55 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-07 16:07 [PATCH v1 0/2] spi: pxa2xx: Clean up linux/spi/pxa2xx_spi.h Andy Shevchenko 2024-03-07 16:07 ` [PATCH v1 1/2] spi: pxa2xx: Kill pxa2xx_set_spi_info() Andy Shevchenko 2024-03-07 16:30 ` Arnd Bergmann 2024-03-07 16:42 ` Andy Shevchenko 2024-03-07 16:47 ` Arnd Bergmann 2024-03-07 16:51 ` Andy Shevchenko 2024-03-07 16:07 ` [PATCH v1 2/2] spi: pxa2xx: Make num_chipselect 8-bit in the struct pxa2xx_spi_controller Andy Shevchenko 2024-03-07 16:37 ` Arnd Bergmann 2024-03-07 16:53 ` Andy Shevchenko 2024-03-07 16:55 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).