summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/arche-apb-ctrl.c
diff options
context:
space:
mode:
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>2016-02-13 02:04:12 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-02-15 13:18:40 -0800
commit6961e0466575608639e91ddbcc62d9385d45a198 (patch)
treeaa65d3cdc5ebd3dbf61361246abbc9504d179280 /drivers/staging/greybus/arche-apb-ctrl.c
parentf2222a41db55f89bfafad03bd04ffdfb317b2edb (diff)
downloadop-kernel-dev-6961e0466575608639e91ddbcc62d9385d45a198.zip
op-kernel-dev-6961e0466575608639e91ddbcc62d9385d45a198.tar.gz
greybus: arche-apb-ctrl: Pass only platform_device to _seq fns
Pass only pointer to platform_device to _seq fns and fetch handle to arche_apb_ctrl_drvdata from platform_device. This is preparation for support for dynamic switching between operational states for the device, where these functions will be called from parent driver. Testing Done: Tested on EVT1.2 and DB3.5 platform. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/arche-apb-ctrl.c')
-rw-r--r--drivers/staging/greybus/arche-apb-ctrl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
index 1d3c112..8f6f096 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -71,10 +71,10 @@ static void unexport_gpios(struct arche_apb_ctrl_drvdata *apb)
/*
* Note: Please do not modify the below sequence, as it is as per the spec
*/
-static int apb_ctrl_coldboot_seq(struct platform_device *pdev,
- struct arche_apb_ctrl_drvdata *apb)
+static int apb_ctrl_coldboot_seq(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
int ret;
/* Hold APB in reset state */
@@ -113,8 +113,10 @@ static int apb_ctrl_coldboot_seq(struct platform_device *pdev,
return 0;
}
-static void apb_ctrl_poweroff_seq(struct arche_apb_ctrl_drvdata *apb)
+static void apb_ctrl_poweroff_seq(struct platform_device *pdev)
{
+ struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
+
/* disable the clock */
if (gpio_is_valid(apb->clk_en_gpio))
gpio_set_value(apb->clk_en_gpio, 0);
@@ -239,15 +241,16 @@ int arche_apb_ctrl_probe(struct platform_device *pdev)
/* Initially set APB to OFF state */
apb->state = ARCHE_PLATFORM_STATE_OFF;
- ret = apb_ctrl_coldboot_seq(pdev, apb);
+ platform_set_drvdata(pdev, apb);
+
+ ret = apb_ctrl_coldboot_seq(pdev);
if (ret) {
dev_err(dev, "failed to set init state of control signal %d\n",
ret);
+ platform_set_drvdata(pdev, NULL);
return ret;
}
- platform_set_drvdata(pdev, apb);
-
export_gpios(apb);
dev_info(&pdev->dev, "Device registered successfully\n");
@@ -258,7 +261,7 @@ int arche_apb_ctrl_remove(struct platform_device *pdev)
{
struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
- apb_ctrl_poweroff_seq(apb);
+ apb_ctrl_poweroff_seq(pdev);
platform_set_drvdata(pdev, NULL);
unexport_gpios(apb);
OpenPOWER on IntegriCloud