Skip to contentSkip to conversation

OMAP Mailbox cleanups for 4.19

PATCH New Suman Anna 1 participant 3 messages Jul 11, 2018 Mailbox API

lore
Share & tools
lore

Suman Anna

author
#0 lore raw

cover OMAP Mailbox cleanups for 4.19

Hi Jassi,

The following series includes couple of cleanup patches on the OMAP Mailbox driver. Please pick them for 4.19.

The first patch switches the licensing to use the SPDX license identifier. The second patch is some code cleanup in preparing the driver to be built against a 64-bit platform in K3 AM654 SoC (support for that in OMAP Mailbox driver will be added once the base K3 AM654 pieces are part of mainline).

regards
Suman

Suman Anna (2):
mailbox/omap: switch to SPDX license identifier mailbox/omap: use of_device_get_match_data() to get match data

 drivers/mailbox/omap-mailbox.c | 31 +++++++++++++++----------------
 include/linux/omap-mailbox.h   |  5 +----
 2 files changed, 16 insertions(+), 20 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/2 mailbox/omap: switch to SPDX license identifier

Use the appropriate SPDX license identifier in the OMAP Mailbox driver source files and drop the previous boilerplate license text.

---
 drivers/mailbox/omap-mailbox.c | 10 +---------
 include/linux/omap-mailbox.h   |  5 +----
 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/mailbox/omap-mailbox.c +1 -9
index e1e2c085e68e..97c7d9b7f46f 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * OMAP mailbox driver
  *
@@ -6,15 +7,6 @@
  *
  * Contact: Hiroshi DOYU <[email protected]>
  *          Suman Anna <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
  */
 
 #include <linux/interrupt.h>
include/linux/omap-mailbox.h +1 -4
index c726bd833761..6dbcd2da0332 100644
@@ -1,9 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * omap-mailbox: interprocessor communication module for OMAP
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
  */
 
 #ifndef OMAP_MAILBOX_H
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 2/2 mailbox/omap: use of_device_get_match_data() to get match data

In reply to Suman Anna

The OMAP Mailbox driver is directly using an integer value as match data for distinguishing the interrupt register layout between OMAP2 and OMAP4+ SoCs. Introduce a dedicated structure for storing this match data, and simplify the probe function by using the of_device_get_match_data() function. This allows the driver to scale for 64-bit platforms by eliminating the unnecessary type-casting between a u32 and a void pointer types.

---
 drivers/mailbox/omap-mailbox.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/mailbox/omap-mailbox.c +14 -7
index 97c7d9b7f46f..db66e952a871 100644
@@ -69,6 +69,10 @@ struct omap_mbox_queue {
 	bool full;
 };
 
+struct omap_mbox_match_data {
+	u32 intr_type;
+};
+
 struct omap_mbox_device {
 	struct device *dev;
 	struct mutex cfg_lock;
@@ -638,18 +642,21 @@ static const struct dev_pm_ops omap_mbox_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(omap_mbox_suspend, omap_mbox_resume)
 };
 
+static const struct omap_mbox_match_data omap2_data = { MBOX_INTR_CFG_TYPE1 };
+static const struct omap_mbox_match_data omap4_data = { MBOX_INTR_CFG_TYPE2 };
+
 static const struct of_device_id omap_mailbox_of_match[] = {
 	{
 		.compatible	= "ti,omap2-mailbox",
-		.data		= (void *)MBOX_INTR_CFG_TYPE1,
+		.data		= &omap2_data,
 	},
 	{
 		.compatible	= "ti,omap3-mailbox",
-		.data		= (void *)MBOX_INTR_CFG_TYPE1,
+		.data		= &omap2_data,
 	},
 	{
 		.compatible	= "ti,omap4-mailbox",
-		.data		= (void *)MBOX_INTR_CFG_TYPE2,
+		.data		= &omap4_data,
 	},
 	{
 		/* end */
@@ -692,7 +699,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
 	struct omap_mbox_fifo *fifo;
 	struct device_node *node = pdev->dev.of_node;
 	struct device_node *child;
-	const struct of_device_id *match;
+	const struct omap_mbox_match_data *match_data;
 	u32 intr_type, info_count;
 	u32 num_users, num_fifos;
 	u32 tmp[3];
@@ -704,10 +711,10 @@ static int omap_mbox_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	match = of_match_device(omap_mailbox_of_match, &pdev->dev);
-	if (!match)
+	match_data = of_device_get_match_data(&pdev->dev);
+	if (!match_data)
 		return -ENODEV;
-	intr_type = (u32)match->data;
+	intr_type = match_data->intr_type;
 
 	if (of_property_read_u32(node, "ti,mbox-num-users", &num_users))
 		return -ENODEV;
Signature · 1 line
2.17.1