tegra: otg: Don't use global functions in board files
Dan Willemsen [Wed, 5 Jan 2011 02:10:33 +0000 (18:10 -0800)]
Releasing the platform_data in unregister.

Original-Change-Id: Iba1c6e7ad42b0886f8ce9dadf9664bcc266398d4
Reviewed-on: http://git-master/r/14963
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: R0e004bd1328eac471c56390b4f79d6ec8c04d877

drivers/usb/otg/tegra-otg.c
include/linux/platform_data/tegra_usb.h

index 1a858b0..e3b7d5f 100644 (file)
@@ -43,9 +43,6 @@
 #define  USB_VBUS_STATUS       (1 << 10)
 #define  USB_INTS              (USB_VBUS_INT_STATUS | USB_ID_INT_STATUS)
 
-extern struct platform_device *tegra_usb_otg_host_register();
-extern void tegra_usb_otg_host_unregister(struct platform_device *pdev);
-
 struct tegra_otg_data {
        struct otg_transceiver otg;
        unsigned long int_status;
@@ -83,15 +80,17 @@ static const char *tegra_state_name(enum usb_otg_state state)
 
 void tegra_start_host(struct tegra_otg_data *tegra)
 {
+       struct tegra_otg_platform_data *pdata = tegra->otg.dev->platform_data;
        if (!tegra->pdev) {
-               tegra->pdev = tegra_usb_otg_host_register();
+               tegra->pdev = pdata->host_register();
        }
 }
 
 void tegra_stop_host(struct tegra_otg_data *tegra)
 {
+       struct tegra_otg_platform_data *pdata = tegra->otg.dev->platform_data;
        if (tegra->pdev) {
-               tegra_usb_otg_host_unregister(tegra->pdev);
+               pdata->host_unregister(tegra->pdev);
                tegra->pdev = NULL;
        }
 }
@@ -255,7 +254,6 @@ static int tegra_otg_probe(struct platform_device *pdev)
        tegra->otg.set_peripheral = tegra_otg_set_peripheral;
        tegra->otg.set_suspend = tegra_otg_set_suspend;
        tegra->otg.set_power = tegra_otg_set_power;
-       tegra->host = pdev->dev.platform_data;
        spin_lock_init(&tegra->lock);
 
        platform_set_drvdata(pdev, tegra);
index 6bca5b5..e48ac43 100644 (file)
@@ -28,4 +28,9 @@ struct tegra_ehci_platform_data {
        void *phy_config;
 };
 
+struct tegra_otg_platform_data {
+       struct platform_device* (*host_register)(void);
+       void (*host_unregister)(struct platform_device*);
+};
+
 #endif /* _TEGRA_USB_H_ */