From patchwork Wed Jul 8 12:26:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 6746661 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28003C05AC for ; Wed, 8 Jul 2015 12:32:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F19920676 for ; Wed, 8 Jul 2015 12:32:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50BF220665 for ; Wed, 8 Jul 2015 12:32:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCoUS-0000iQ-BO; Wed, 08 Jul 2015 12:30:16 +0000 Received: from mail-pd0-f173.google.com ([209.85.192.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCoUD-0007jJ-KL for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2015 12:30:02 +0000 Received: by pddu5 with SMTP id u5so57653504pdd.3 for ; Wed, 08 Jul 2015 05:29:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9Pzv0AxyRKuwEPDeV+y9TeEQQc0M4Oaq8UyJKp/Z5To=; b=Fa7pt0956BqwZSK0Tlau1FaZzEVdagj6VGbKENJ9exv6PvSadWWyA2ECGpwL7swrTm jGtGsUehQg6/+iUncdcwQBK6+YogX/f+ASqD51QtAyno5R++uvEyZe4NJmlLZwdY9oNA PgRrHrvmjahlrSfB+KdHnYfdeSOBTLplapHkHgpHn973rB0wL/cvas+nA2SfbyfEt5Bk jTMVTg3MAM8MBICRGj/OF02pQfFhhzhH8kzwjp+VXLosOXOIrMEJ9/jult4vUwT4uaKs miW/4u45z3HgeVBzEgYys3xqOKtWSp7a6ab4MNSSIBVx2zgfbaQe/m0UNUg8qFEU0cHt 66YA== X-Gm-Message-State: ALoCoQmxJ3b3DvuurS+CC68/jb7PonssekT3XZsnBxR4AvO3rgQY2d6OJTWTm3SZjhzP4GVeb285 X-Received: by 10.68.135.233 with SMTP id pv9mr20326418pbb.115.1436358580912; Wed, 08 Jul 2015 05:29:40 -0700 (PDT) Received: from localhost.localdomain ([202.62.93.138]) by smtp.gmail.com with ESMTPSA id db1sm2415741pdb.50.2015.07.08.05.29.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jul 2015 05:29:39 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Subject: [PATCH-v6 3/6] mfd: 88pm800: Get pdata from 'device' rather than passing as a parameter Date: Wed, 8 Jul 2015 17:56:29 +0530 Message-Id: <1436358392-15449-4-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436358392-15449-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1436358392-15449-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150708_053001_708182_79E860FD X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: 0.7 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: open list , Lee Jones , Vaibhav Hiremath , Samuel Ortiz MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SBL_CSS, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the device_xxx_init() fns take pdata as an input parameter to the fn, but the cleaner approach would be to use dev_get_platdata() to get the pdata. So this patch changes the code accordingly. Signed-off-by: Vaibhav Hiremath Acked-by: Lee Jones --- drivers/mfd/88pm800.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 95c418c..af8232f 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -254,11 +254,11 @@ static const struct regmap_irq pm800_irqs[] = { }, }; -static int device_gpadc_init(struct pm80x_chip *chip, - struct pm80x_platform_data *pdata) +static int device_gpadc_init(struct pm80x_chip *chip) { struct pm80x_subchip *subchip = chip->subchip; struct regmap *map = subchip->regmap_gpadc; + struct pm80x_platform_data *pdata = dev_get_platdata(chip->dev); int data = 0, mask = 0, ret = 0; if (!map) { @@ -320,17 +320,17 @@ out: return ret; } -static int device_onkey_init(struct pm80x_chip *chip, - struct pm80x_platform_data *pdata) +static int device_onkey_init(struct pm80x_chip *chip) { return mfd_add_devices(chip->dev, 0, &onkey_devs[0], ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0, NULL); } -static int device_rtc_init(struct pm80x_chip *chip, - struct pm80x_platform_data *pdata) +static int device_rtc_init(struct pm80x_chip *chip) { + struct pm80x_platform_data *pdata = dev_get_platdata(chip->dev); + if (pdata) { rtc_devs[0].platform_data = pdata->rtc; rtc_devs[0].pdata_size = @@ -341,8 +341,7 @@ static int device_rtc_init(struct pm80x_chip *chip, ARRAY_SIZE(rtc_devs), NULL, 0, NULL); } -static int device_regulator_init(struct pm80x_chip *chip, - struct pm80x_platform_data *pdata) +static int device_regulator_init(struct pm80x_chip *chip) { return mfd_add_devices(chip->dev, 0, ®ulator_devs[0], ARRAY_SIZE(regulator_devs), NULL, 0, NULL); @@ -463,11 +462,11 @@ static void pm800_pages_exit(struct pm80x_chip *chip) i2c_unregister_device(subchip->gpadc_page); } -static int device_800_init(struct pm80x_chip *chip, - struct pm80x_platform_data *pdata) +static int device_800_init(struct pm80x_chip *chip) { int ret; unsigned int val; + struct pm80x_platform_data *pdata = dev_get_platdata(chip->dev); /* * alarm wake up bit will be clear in device_irq_init(), @@ -483,7 +482,7 @@ static int device_800_init(struct pm80x_chip *chip, pdata->rtc->rtc_wakeup = 1; } - ret = device_gpadc_init(chip, pdata); + ret = device_gpadc_init(chip); if (ret < 0) { dev_err(chip->dev, "[%s]Failed to init gpadc\n", __func__); goto out; @@ -497,19 +496,19 @@ static int device_800_init(struct pm80x_chip *chip, goto out; } - ret = device_onkey_init(chip, pdata); + ret = device_onkey_init(chip); if (ret) { dev_err(chip->dev, "Failed to add onkey subdev\n"); goto out_dev; } - ret = device_rtc_init(chip, pdata); + ret = device_rtc_init(chip); if (ret) { dev_err(chip->dev, "Failed to add rtc subdev\n"); goto out; } - ret = device_regulator_init(chip, pdata); + ret = device_regulator_init(chip); if (ret) { dev_err(chip->dev, "Failed to add regulators subdev\n"); goto out; @@ -575,7 +574,7 @@ static int pm800_probe(struct i2c_client *client, goto err_device_init; } - ret = device_800_init(chip, pdata); + ret = device_800_init(chip); if (ret) { dev_err(chip->dev, "Failed to initialize 88pm800 devices\n"); goto err_device_init;