devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings
@ 2020-09-30  9:14 Thomas Kopp
  2020-09-30  9:14 ` [PATCH 2/2] " Thomas Kopp
  2020-09-30  9:15 ` [PATCH 1/2] " Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Kopp @ 2020-09-30  9:14 UTC (permalink / raw)
  To: mkl, manivannan.sadhasivam, o.rempel, geert
  Cc: linux-can, thomas.kopp, dev.kurt, devicetree, robh+dt, wg

The wildcard should be narrowed down to prevent existing and
future devices that are not compatible from matching.
It is very unlikely that incompatible devices will be released
that do not match the wildcard.

Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com/

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>

Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
---
 drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 18 +++++++++---------
 drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h      |  4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index 5557b2d1e774..672d5f24e325 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -41,10 +41,10 @@ static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp2518fd = {
 };
 
 /* Autodetect model, start with CRC enabled. */
-static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp25xxfd = {
+static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp251xfd = {
 	.quirks = MCP25XXFD_QUIRK_CRC_REG | MCP25XXFD_QUIRK_CRC_RX |
 		MCP25XXFD_QUIRK_CRC_TX | MCP25XXFD_QUIRK_ECC,
-	.model = MCP25XXFD_MODEL_MCP25XXFD,
+	.model = MCP25XXFD_MODEL_MCP251XFD,
 };
 
 static const struct can_bittiming_const mcp25xxfd_bittiming_const = {
@@ -78,8 +78,8 @@ static const char *__mcp25xxfd_get_model_str(enum mcp25xxfd_model model)
 		return "MCP2517FD"; break;
 	case MCP25XXFD_MODEL_MCP2518FD:
 		return "MCP2518FD"; break;
-	case MCP25XXFD_MODEL_MCP25XXFD:
-		return "MCP25xxFD"; break;
+	case MCP25XXFD_MODEL_MCP251XFD:
+		return "MCP251xFD"; break;
 	}
 
 	return "<unknown>";
@@ -2498,7 +2498,7 @@ static int mcp25xxfd_register_chip_detect(struct mcp25xxfd_priv *priv)
 	else
 		devtype_data = &mcp25xxfd_devtype_data_mcp2517fd;
 
-	if (!mcp25xxfd_is_25XX(priv) &&
+	if (!mcp25xxfd_is_251X(priv) &&
 	    priv->devtype_data.model != devtype_data->model) {
 		netdev_info(ndev,
 			    "Detected %s, but firmware specifies a %s. Fixing up.",
@@ -2707,8 +2707,8 @@ static const struct of_device_id mcp25xxfd_of_match[] = {
 		.compatible = "microchip,mcp2518fd",
 		.data = &mcp25xxfd_devtype_data_mcp2518fd,
 	}, {
-		.compatible = "microchip,mcp25xxfd",
-		.data = &mcp25xxfd_devtype_data_mcp25xxfd,
+		.compatible = "microchip,mcp251xfd",
+		.data = &mcp25xxfd_devtype_data_mcp251xfd,
 	}, {
 		/* sentinel */
 	},
@@ -2723,8 +2723,8 @@ static const struct spi_device_id mcp25xxfd_id_table[] = {
 		.name = "mcp2518fd",
 		.driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp2518fd,
 	}, {
-		.name = "mcp25xxfd",
-		.driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp25xxfd,
+		.name = "mcp251xfd",
+		.driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp251xfd,
 	}, {
 		/* sentinel */
 	},
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
index 3bc799204cb0..b1b5d7fd33ea 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
@@ -553,7 +553,7 @@ struct mcp25xxfd_regs_status {
 enum mcp25xxfd_model {
 	MCP25XXFD_MODEL_MCP2517FD = 0x2517,
 	MCP25XXFD_MODEL_MCP2518FD = 0x2518,
-	MCP25XXFD_MODEL_MCP25XXFD = 0xffff,	/* autodetect model */
+	MCP25XXFD_MODEL_MCP251XFD = 0xffff,	/* autodetect model */
 };
 
 struct mcp25xxfd_devtype_data {
@@ -607,7 +607,7 @@ mcp25xxfd_is_##_model(const struct mcp25xxfd_priv *priv) \
 
 MCP25XXFD_IS(2517);
 MCP25XXFD_IS(2518);
-MCP25XXFD_IS(25XX);
+MCP25XXFD_IS(251X);
 
 static inline u8 mcp25xxfd_first_byte_set(u32 mask)
 {
-- 
2.25.1


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

* [PATCH 2/2] can: mcp25xxfd: narrow down wildcards in device tree bindings
  2020-09-30  9:14 [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings Thomas Kopp
@ 2020-09-30  9:14 ` Thomas Kopp
  2020-09-30  9:15 ` [PATCH 1/2] " Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Kopp @ 2020-09-30  9:14 UTC (permalink / raw)
  To: mkl, manivannan.sadhasivam, o.rempel, geert
  Cc: linux-can, thomas.kopp, dev.kurt, devicetree, robh+dt, wg

The wildcard should be narrowed down to prevent existing and
future devices that are not compatible from matching.
It is very unlikely that incompatible devices will be released
that do not match the wildcard.

This is the documentation part of the commit.

Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com/

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>

Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
---
 .../devicetree/bindings/net/can/microchip,mcp25xxfd.yaml      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
index 5beb00a614bf..6765f4c611c5 100644
--- a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
@@ -18,7 +18,7 @@ properties:
         description: for MCP2517FD
       - const: microchip,mcp2518fd
         description: for MCP2518FD
-      - const: microchip,mcp25xxfd
+      - const: microchip,mcp251xfd
         description: to autodetect chip variant
 
   reg:
@@ -65,7 +65,7 @@ examples:
         #size-cells = <0>;
 
         can@0 {
-            compatible = "microchip,mcp25xxfd";
+            compatible = "microchip,mcp251xfd";
             reg = <0>;
             clocks = <&can0_osc>;
             pinctrl-names = "default";
-- 
2.25.1


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

* Re: [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings
  2020-09-30  9:14 [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings Thomas Kopp
  2020-09-30  9:14 ` [PATCH 2/2] " Thomas Kopp
@ 2020-09-30  9:15 ` Marc Kleine-Budde
  2020-09-30  9:26   ` Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30  9:15 UTC (permalink / raw)
  To: Thomas Kopp, manivannan.sadhasivam, o.rempel, geert
  Cc: linux-can, dev.kurt, devicetree, robh+dt, wg


[-- Attachment #1.1: Type: text/plain, Size: 818 bytes --]

On 9/30/20 11:14 AM, Thomas Kopp wrote:
> The wildcard should be narrowed down to prevent existing and
> future devices that are not compatible from matching.
> It is very unlikely that incompatible devices will be released
> that do not match the wildcard.
> 
> Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com/
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>

lol, who was faster? :D

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings
  2020-09-30  9:15 ` [PATCH 1/2] " Marc Kleine-Budde
@ 2020-09-30  9:26   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30  9:26 UTC (permalink / raw)
  To: Thomas Kopp, manivannan.sadhasivam, o.rempel, geert
  Cc: linux-can, dev.kurt, devicetree, robh+dt, wg


[-- Attachment #1.1: Type: text/plain, Size: 912 bytes --]

On 9/30/20 11:15 AM, Marc Kleine-Budde wrote:
> On 9/30/20 11:14 AM, Thomas Kopp wrote:
>> The wildcard should be narrowed down to prevent existing and
>> future devices that are not compatible from matching.
>> It is very unlikely that incompatible devices will be released
>> that do not match the wildcard.
>>
>> Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com/
>>
>> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
> 
> lol, who was faster? :D

I've taken your patches.

Tnx,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-09-30  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  9:14 [PATCH 1/2] can: mcp25xxfd: narrow down wildcards in device tree bindings Thomas Kopp
2020-09-30  9:14 ` [PATCH 2/2] " Thomas Kopp
2020-09-30  9:15 ` [PATCH 1/2] " Marc Kleine-Budde
2020-09-30  9:26   ` Marc Kleine-Budde

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