linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data
@ 2021-04-14 20:33 Krzysztof Kozlowski
  2021-04-14 20:33 ` [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-14 20:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski, Sylwester Nawrocki

Use of_device_get_match_data() to make the code slightly smaller and to
remove the of_device_id table forward declaration.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/spi/spi-s3c64xx.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index dfa7c91e13aa..c6d7641ea342 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -15,6 +15,7 @@
 #include <linux/spi/spi.h>
 #include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_gpio.h>
 
 #include <linux/platform_data/spi-s3c64xx.h>
@@ -1048,17 +1049,12 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
 }
 #endif
 
-static const struct of_device_id s3c64xx_spi_dt_match[];
-
 static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
 						struct platform_device *pdev)
 {
 #ifdef CONFIG_OF
-	if (pdev->dev.of_node) {
-		const struct of_device_id *match;
-		match = of_match_node(s3c64xx_spi_dt_match, pdev->dev.of_node);
-		return (struct s3c64xx_spi_port_config *)match->data;
-	}
+	if (pdev->dev.of_node)
+		return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev);
 #endif
 	return (struct s3c64xx_spi_port_config *)
 			 platform_get_device_id(pdev)->driver_data;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config
  2021-04-14 20:33 [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Krzysztof Kozlowski
@ 2021-04-14 20:33 ` Krzysztof Kozlowski
  2021-04-15  9:53   ` Sylwester Nawrocki
  2021-04-14 20:33 ` [PATCH 3/3] spi: s3c64xx: constify driver/match data Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-14 20:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski, Sylwester Nawrocki

Correct the name of s3c64xx_spi_port_config structure in kerneldoc:

  drivers/spi/spi-s3c64xx.c:154: warning:
    expecting prototype for struct s3c64xx_spi_info. Prototype was for struct s3c64xx_spi_port_config instead

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/spi/spi-s3c64xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index c6d7641ea342..eac3c300f806 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -128,7 +128,7 @@ struct s3c64xx_spi_dma_data {
 };
 
 /**
- * struct s3c64xx_spi_info - SPI Controller hardware info
+ * struct s3c64xx_spi_port_config - SPI Controller hardware info
  * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register.
  * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter.
  * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter.
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] spi: s3c64xx: constify driver/match data
  2021-04-14 20:33 [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-14 20:33 ` [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Krzysztof Kozlowski
@ 2021-04-14 20:33 ` Krzysztof Kozlowski
  2021-04-15  9:54   ` Sylwester Nawrocki
  2021-04-15  9:48 ` [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Sylwester Nawrocki
  2021-04-15 18:33 ` Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-14 20:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski, Sylwester Nawrocki

The match data (struct s3c64xx_spi_port_config) stored in of_device_id
and platform_device_id tables is not modified by the driver and can be
handled entirely in a const-way to increase the code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/spi/spi-s3c64xx.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index eac3c300f806..8755cd85e83c 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -190,7 +190,7 @@ struct s3c64xx_spi_driver_data {
 	unsigned                        cur_speed;
 	struct s3c64xx_spi_dma_data	rx_dma;
 	struct s3c64xx_spi_dma_data	tx_dma;
-	struct s3c64xx_spi_port_config	*port_conf;
+	const struct s3c64xx_spi_port_config	*port_conf;
 	unsigned int			port_id;
 };
 
@@ -1049,15 +1049,14 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
 }
 #endif
 
-static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
+static inline const struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
 						struct platform_device *pdev)
 {
 #ifdef CONFIG_OF
 	if (pdev->dev.of_node)
-		return (struct s3c64xx_spi_port_config *)of_device_get_match_data(&pdev->dev);
+		return of_device_get_match_data(&pdev->dev);
 #endif
-	return (struct s3c64xx_spi_port_config *)
-			 platform_get_device_id(pdev)->driver_data;
+	return (const struct s3c64xx_spi_port_config *)platform_get_device_id(pdev)->driver_data;
 }
 
 static int s3c64xx_spi_probe(struct platform_device *pdev)
@@ -1395,27 +1394,27 @@ static const struct dev_pm_ops s3c64xx_spi_pm = {
 			   s3c64xx_spi_runtime_resume, NULL)
 };
 
-static struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
+static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
 	.fifo_lvl_mask	= { 0x7f },
 	.rx_lvl_offset	= 13,
 	.tx_st_done	= 21,
 	.high_speed	= true,
 };
 
-static struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
+static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
 	.fifo_lvl_mask	= { 0x7f, 0x7F },
 	.rx_lvl_offset	= 13,
 	.tx_st_done	= 21,
 };
 
-static struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
+static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
 	.fifo_lvl_mask	= { 0x1ff, 0x7F },
 	.rx_lvl_offset	= 15,
 	.tx_st_done	= 25,
 	.high_speed	= true,
 };
 
-static struct s3c64xx_spi_port_config exynos4_spi_port_config = {
+static const struct s3c64xx_spi_port_config exynos4_spi_port_config = {
 	.fifo_lvl_mask	= { 0x1ff, 0x7F, 0x7F },
 	.rx_lvl_offset	= 15,
 	.tx_st_done	= 25,
@@ -1424,7 +1423,7 @@ static struct s3c64xx_spi_port_config exynos4_spi_port_config = {
 	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
 };
 
-static struct s3c64xx_spi_port_config exynos7_spi_port_config = {
+static const struct s3c64xx_spi_port_config exynos7_spi_port_config = {
 	.fifo_lvl_mask	= { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff},
 	.rx_lvl_offset	= 15,
 	.tx_st_done	= 25,
@@ -1433,7 +1432,7 @@ static struct s3c64xx_spi_port_config exynos7_spi_port_config = {
 	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
 };
 
-static struct s3c64xx_spi_port_config exynos5433_spi_port_config = {
+static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = {
 	.fifo_lvl_mask	= { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff},
 	.rx_lvl_offset	= 15,
 	.tx_st_done	= 25,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data
  2021-04-14 20:33 [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-14 20:33 ` [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Krzysztof Kozlowski
  2021-04-14 20:33 ` [PATCH 3/3] spi: s3c64xx: constify driver/match data Krzysztof Kozlowski
@ 2021-04-15  9:48 ` Sylwester Nawrocki
  2021-04-15 18:33 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2021-04-15  9:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski



On 14.04.2021 22:33, Krzysztof Kozlowski wrote:
> Use of_device_get_match_data() to make the code slightly smaller and to
> remove the of_device_id table forward declaration.
> 
> Signed-off-by: Krzysztof Kozlowski<krzysztof.kozlowski@canonical.com>

Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config
  2021-04-14 20:33 ` [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Krzysztof Kozlowski
@ 2021-04-15  9:53   ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2021-04-15  9:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski


On 14.04.2021 22:33, Krzysztof Kozlowski wrote:
> Correct the name of s3c64xx_spi_port_config structure in kerneldoc:
> 
>    drivers/spi/spi-s3c64xx.c:154: warning:
>      expecting prototype for struct s3c64xx_spi_info. Prototype was for struct s3c64xx_spi_port_config instead
> 
> Signed-off-by: Krzysztof Kozlowski<krzysztof.kozlowski@canonical.com>


Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] spi: s3c64xx: constify driver/match data
  2021-04-14 20:33 ` [PATCH 3/3] spi: s3c64xx: constify driver/match data Krzysztof Kozlowski
@ 2021-04-15  9:54   ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2021-04-15  9:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andi Shyti, Mark Brown, linux-spi,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Marek Szyprowski


On 14.04.2021 22:33, Krzysztof Kozlowski wrote:
> The match data (struct s3c64xx_spi_port_config) stored in of_device_id
> and platform_device_id tables is not modified by the driver and can be
> handled entirely in a const-way to increase the code safety.
> 
> Signed-off-by: Krzysztof Kozlowski<krzysztof.kozlowski@canonical.com>

Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data
  2021-04-14 20:33 [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2021-04-15  9:48 ` [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Sylwester Nawrocki
@ 2021-04-15 18:33 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2021-04-15 18:33 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, Krzysztof Kozlowski,
	linux-spi, linux-kernel, Andi Shyti
  Cc: Mark Brown, Sylwester Nawrocki, Marek Szyprowski

On Wed, 14 Apr 2021 22:33:41 +0200, Krzysztof Kozlowski wrote:
> Use of_device_get_match_data() to make the code slightly smaller and to
> remove the of_device_id table forward declaration.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: s3c64xx: simplify getting of_device_id match data
      commit: 609a2f9529d3d3e627776614b6cff34b21f64144
[2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config
      commit: 7d712f799a938b37d24359ea836f58866be5e0bb
[3/3] spi: s3c64xx: constify driver/match data
      commit: d6371415517700ae225dd1aaa8a35a86a659ada6

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-15 18:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 20:33 [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Krzysztof Kozlowski
2021-04-14 20:33 ` [PATCH 2/3] spi: s3c64xx: correct kerneldoc of s3c64xx_spi_port_config Krzysztof Kozlowski
2021-04-15  9:53   ` Sylwester Nawrocki
2021-04-14 20:33 ` [PATCH 3/3] spi: s3c64xx: constify driver/match data Krzysztof Kozlowski
2021-04-15  9:54   ` Sylwester Nawrocki
2021-04-15  9:48 ` [PATCH 1/3] spi: s3c64xx: simplify getting of_device_id match data Sylwester Nawrocki
2021-04-15 18:33 ` Mark Brown

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).