From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754823AbbFBFIK (ORCPT ); Tue, 2 Jun 2015 01:08:10 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:32820 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814AbbFBFIB (ORCPT ); Tue, 2 Jun 2015 01:08:01 -0400 Message-ID: <556D3A14.6050505@linaro.org> Date: Tue, 02 Jun 2015 10:37:32 +0530 From: Vaibhav Hiremath User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Lee Jones CC: linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, sameo@linux.intel.com, a.zummo@towertech.it, alexandre.belloni@free-electrons.com, Chao Xie Subject: Re: [PATCH 4/4] mfd: 88pm800: allocate pdata->rtc if not allocated earlier References: <1432937962-4537-1-git-send-email-vaibhav.hiremath@linaro.org> <1432937962-4537-5-git-send-email-vaibhav.hiremath@linaro.org> <20150601082200.GC3329@x1> In-Reply-To: <20150601082200.GC3329@x1> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 01 June 2015 01:52 PM, Lee Jones wrote: > On Sat, 30 May 2015, Vaibhav Hiremath wrote: > >> RTC in pmic 88PM800 can run even the core is powered off, and user >> can set alarm in RTC. When the alarm is timed out, the PMIC will power up >> the core, and the whole system will boot up. And during PMIC driver probe, >> it will read some register to find out whether this boot is caused by RTC >> timeout or not, and pass on this information to the RTC driver. >> >> So we need rtc platform data to be existed in PMIC driver to pass this >> information. >> >> Signed-off-by: Chao Xie >> Signed-off-by: Vaibhav Hiremath >> --- >> drivers/mfd/88pm800.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c >> index 8ea4467..34546a1 100644 >> --- a/drivers/mfd/88pm800.c >> +++ b/drivers/mfd/88pm800.c >> @@ -586,6 +586,25 @@ static int pm800_probe(struct i2c_client *client, >> return ret; >> } >> >> + /* >> + * RTC in pmic can run even the core is powered off, and user can set >> + * alarm in RTC. When the alarm is time out, the PMIC will power up >> + * the core, and the whole system will boot up. When PMIC driver is >> + * probed, it will read out some register to find out whether this >> + * boot is caused by RTC timeout or not, and it need pass this >> + * information to RTC driver. >> + * So we need rtc platform data to be existed to pass this information. >> + */ >> + if (!pdata->rtc) { >> + pdata->rtc = devm_kzalloc(&client->dev, >> + sizeof(*(pdata->rtc)), GFP_KERNEL); >> + if (!pdata->rtc) { >> + dev_err(&client->dev, >> + "failed to allocate memory for rtc\n"); >> + return -ENOMEM; >> + } >> + } >> + > > Where is this memory first used? > In the same file, look for field "rtc_wakeup". FYI, This field is used in two files, drivers/mfd/88pm800.c and drivers/rtc/rtc-88pm800.c [sets the "platform_data" field] Thanks, Vaibhav