From patchwork Tue Sep 27 10:12:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 4364 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7773E23EFA for ; Tue, 27 Sep 2011 10:13:31 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 6C29AA18065 for ; Tue, 27 Sep 2011 10:13:31 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so9690167fxe.11 for ; Tue, 27 Sep 2011 03:13:31 -0700 (PDT) Received: by 10.223.30.151 with SMTP id u23mr2844110fac.122.1317118411328; Tue, 27 Sep 2011 03:13:31 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.3.234 with SMTP id f10cs67261laf; Tue, 27 Sep 2011 03:13:31 -0700 (PDT) Received: by 10.101.75.9 with SMTP id c9mr4758695anl.153.1317118408690; Tue, 27 Sep 2011 03:13:28 -0700 (PDT) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com. [192.94.94.40]) by mx.google.com with ESMTPS id n9si12693407ann.59.2011.09.27.03.13.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 03:13:28 -0700 (PDT) Received-SPF: pass (google.com: domain of rnayak@ti.com designates 192.94.94.40 as permitted sender) client-ip=192.94.94.40; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rnayak@ti.com designates 192.94.94.40 as permitted sender) smtp.mail=rnayak@ti.com Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p8RADN3V005590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Sep 2011 05:13:25 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p8RADNc6024606; Tue, 27 Sep 2011 15:43:23 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Tue, 27 Sep 2011 15:43:23 +0530 Received: from ula0131687.apr.dhcp.ti.com (ula0131687-172024137082.apr.dhcp.ti.com [172.24.137.82]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p8RAD81N019725; Tue, 27 Sep 2011 15:43:22 +0530 (IST) From: Rajendra Nayak To: , CC: , , , , , , , Rajendra Nayak Subject: [PATCH 6/9] regulator: make fixed regulator driver extract data from dt Date: Tue, 27 Sep 2011 15:42:49 +0530 Message-ID: <1317118372-17052-7-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1317118372-17052-1-git-send-email-rnayak@ti.com> References: <1317118372-17052-1-git-send-email-rnayak@ti.com> MIME-Version: 1.0 Modify the fixed regulator driver to extract fixed_voltage_config from device tree when passed, instead of getting it through platform_data structures (on non-DT builds) Signed-off-by: Rajendra Nayak --- drivers/regulator/fixed.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index c09f791..0a9a10d 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -140,10 +140,15 @@ static struct regulator_ops fixed_voltage_ops = { static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) { - struct fixed_voltage_config *config = pdev->dev.platform_data; + struct fixed_voltage_config *config; struct fixed_voltage_data *drvdata; int ret; + if (pdev->dev.of_node) + config = of_get_fixed_voltage_config(&pdev->dev); + else + config = pdev->dev.platform_data; + drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL); if (drvdata == NULL) { dev_err(&pdev->dev, "Failed to allocate device data\n"); @@ -252,12 +257,23 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) return 0; } +#if defined(CONFIG_OF) +static const struct of_device_id fixed_of_match[] __devinitconst = { + { .compatible = "regulator-fixed", }, + {}, +}; +MODULE_DEVICE_TABLE(of, fixed_of_match); +#else +#define fixed_of_match NULL +#endif + static struct platform_driver regulator_fixed_voltage_driver = { .probe = reg_fixed_voltage_probe, .remove = __devexit_p(reg_fixed_voltage_remove), .driver = { .name = "reg-fixed-voltage", .owner = THIS_MODULE, + .of_match_table = fixed_of_match, }, };