Skip to contentSkip to conversation

mfd: at91-usart: Constify at91_usart_spi_subdev and at91_usart_serial_subdev

PATCH Applied Axel Lin 2 participants 4 messages Jan 31, 2019 – Feb 7, 2019

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 mfd: at91-usart: Constify at91_usart_spi_subdev and at91_usart_serial_subdev

They are never get changed, make them constant.
While at it, fix indent as well.

---
 drivers/mfd/at91-usart.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mfd/at91-usart.c +8 -8
index d20747f612c1..684d3a8db661 100644
@@ -15,15 +15,15 @@
 #include <linux/of.h>
 #include <linux/property.h>
 
-static struct mfd_cell at91_usart_spi_subdev = {
-		.name = "at91_usart_spi",
-		.of_compatible = "microchip,at91sam9g45-usart-spi",
-	};
+static const struct mfd_cell at91_usart_spi_subdev = {
+	.name = "at91_usart_spi",
+	.of_compatible = "microchip,at91sam9g45-usart-spi",
+};
 
-static struct mfd_cell at91_usart_serial_subdev = {
-		.name = "atmel_usart_serial",
-		.of_compatible = "atmel,at91rm9200-usart-serial",
-	};
+static const struct mfd_cell at91_usart_serial_subdev = {
+	.name = "atmel_usart_serial",
+	.of_compatible = "atmel,at91rm9200-usart-serial",
+};
 
 static int at91_usart_mode_probe(struct platform_device *pdev)
 {
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 mfd: at91-usart: No need to copy mfd_cell in probe

Use pointer instead.

---
 drivers/mfd/at91-usart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/at91-usart.c +4 -4
index 684d3a8db661..6a8351a4588e 100644
@@ -27,17 +27,17 @@ static const struct mfd_cell at91_usart_serial_subdev = {
 
 static int at91_usart_mode_probe(struct platform_device *pdev)
 {
-	struct mfd_cell cell;
+	const struct mfd_cell *cell;
 	u32 opmode = AT91_USART_MODE_SERIAL;
 
 	device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode);
 
 	switch (opmode) {
 	case AT91_USART_MODE_SPI:
-		cell = at91_usart_spi_subdev;
+		cell = &at91_usart_spi_subdev;
 		break;
 	case AT91_USART_MODE_SERIAL:
-		cell = at91_usart_serial_subdev;
+		cell = &at91_usart_serial_subdev;
 		break;
 	default:
 		dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n",
@@ -45,7 +45,7 @@ static int at91_usart_mode_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1,
+	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, cell, 1,
 			      NULL, 0, NULL);
 }
 
Signature · 1 line
2.17.1
Applied
#2 lore raw

Re: [PATCH 2/2] mfd: at91-usart: No need to copy mfd_cell in probe

Quoted 6 lines · Axel Lin

Use pointer instead.

---
 drivers/mfd/at91-usart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Applied
#3 lore raw
In reply to Axel Lin
Quoted 7 lines · Axel Lin

They are never get changed, make them constant.
While at it, fix indent as well.

---
 drivers/mfd/at91-usart.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog