[PATCH] USB: fsl-mph-dr-of.c: fix spelling for dr_mode and cleanup code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix a spelling bug in dr_mode_data table for 'peripheral' mode
and do some code cleanup as suggested after driver review.

Signed-off-by: Anatolij Gustschin <agust@xxxxxxx>
---
Note: This patch is for linux-next.

 drivers/usb/host/Kconfig         |    1 -
 drivers/usb/host/fsl-mph-dr-of.c |   34 +++++++++++++++++-----------------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 90e50f0..0f7acf2 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -116,7 +116,6 @@ config XPS_USB_HCD_XILINX
 
 config USB_FSL_MPH_DR_OF
 	bool
-	depends on PPC_OF
 
 config USB_EHCI_FSL
 	bool "Support for Freescale on-chip EHCI USB controller"
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 0ced9fc..3572ac7 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -24,19 +24,19 @@ struct fsl_usb2_dev_data {
 
 struct fsl_usb2_dev_data dr_mode_data[] __devinitdata = {
 	{
-		"host",
-		{ "fsl-ehci", NULL, NULL, },
-		FSL_USB2_DR_HOST,
+		.dr_mode = "host",
+		.drivers = { "fsl-ehci", NULL, NULL, },
+		.op_mode = FSL_USB2_DR_HOST,
 	},
 	{
-		"otg",
-		{ "fsl-ehci", "fsl-usb2-udc", "fsl-usb2-otg", },
-		FSL_USB2_DR_OTG,
+		.dr_mode = "otg",
+		.drivers = { "fsl-ehci", "fsl-usb2-udc", "fsl-usb2-otg", },
+		.op_mode = FSL_USB2_DR_OTG,
 	},
 	{
-		"periferal",
-		{ "fsl-usb2-udc", NULL, NULL, },
-		FSL_USB2_DR_DEVICE,
+		.dr_mode = "peripheral",
+		.drivers = { "fsl-usb2-udc", NULL, NULL, },
+		.op_mode = FSL_USB2_DR_DEVICE,
 	},
 };
 
@@ -52,6 +52,8 @@ struct fsl_usb2_dev_data * __devinit get_dr_mode_data(struct device_node *np)
 				return &dr_mode_data[i];
 		}
 	}
+	pr_warn("%s: Invalid 'dr_mode' property, fallback to host mode\n",
+		np->full_name);
 	return &dr_mode_data[0]; /* mode not specified, use host */
 }
 
@@ -71,10 +73,10 @@ static enum fsl_usb2_phy_modes __devinit determine_usb_phy(const char *phy_type)
 	return FSL_USB2_PHY_NONE;
 }
 
-struct platform_device * __devinit
-fsl_usb2_device_register(struct of_device *ofdev,
-			 struct fsl_usb2_platform_data *pdata,
-			 const char *name, int id)
+struct platform_device * __devinit fsl_usb2_device_register(
+					struct of_device *ofdev,
+					struct fsl_usb2_platform_data *pdata,
+					const char *name, int id)
 {
 	struct platform_device *pdev;
 	const struct resource *res = ofdev->resource;
@@ -137,12 +139,10 @@ static int __devinit fsl_usb2_mph_dr_of_probe(struct of_device *ofdev,
 	dev_data = get_dr_mode_data(np);
 
 	if (of_device_is_compatible(np, "fsl-usb2-mph")) {
-		prop = of_get_property(np, "port0", NULL);
-		if (prop)
+		if (of_get_property(np, "port0", NULL))
 			pdata->port_enables |= FSL_USB2_PORT0_ENABLED;
 
-		prop = of_get_property(np, "port1", NULL);
-		if (prop)
+		if (of_get_property(np, "port1", NULL))
 			pdata->port_enables |= FSL_USB2_PORT1_ENABLED;
 
 		pdata->operating_mode = FSL_USB2_MPH_HOST;
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux