linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: a.zummo@towertech.it, sameo@linux.intel.com,
	broonie@opensource.wolfsonmicro.com, ldewangan@nvidia.com,
	kyle.manna@fuel7.com, rtc-linux@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: tps65910: Add RTC driver for TPS65910 PMIC RTC
Date: Mon, 30 Jul 2012 02:16:59 -0700	[thread overview]
Message-ID: <5016510B.9010202@codeaurora.org> (raw)
In-Reply-To: <1343284519-30505-1-git-send-email-vbyravarasu@nvidia.com>

On 7/25/2012 11:35 PM, Venu Byravarasu wrote:
> +
> +static struct rtc_class_ops tps65910_rtc_ops = {

const?

> +	.read_time	= tps65910_rtc_read_time,
> +	.set_time	= tps65910_rtc_set_time,
> +	.read_alarm	= tps65910_rtc_read_alarm,
> +	.set_alarm	= tps65910_rtc_set_alarm,
> +	.alarm_irq_enable = tps65910_rtc_alarm_irq_enable,
> +};
> +
> +static int __devinit tps65910_rtc_probe(struct platform_device *pdev)
> +{
> +	struct tps65910 *tps65910 = NULL;
> +	struct tps65910_rtc *tps_rtc = NULL;
> +	struct tps65910_board *pmic_plat_data;
> +	int ret = -EINVAL;
> +	int irq = 0;
> +	u32 rtc_reg;

It seems like all the above assignments are useless as they're
overwritten later in this function. Can you remove the assignments?

> +
> +	tps65910 = dev_get_drvdata(pdev->dev.parent);
> +
> +	tps_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps65910_rtc),
> +			GFP_KERNEL);
> +	if (!tps_rtc)
> +		return -ENOMEM;
> +
> +	/* Clear pending interrupts */
> +	ret = regmap_read(tps65910->regmap, TPS65910_RTC_STATUS, &rtc_reg);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = regmap_write(tps65910->regmap, TPS65910_RTC_STATUS, rtc_reg);
> +	if (ret < 0)
> +		return ret;
> +
> +	dev_dbg(&pdev->dev, "Enabling tps65910-RTC.\n");

Hmph, looks more like stopping the RTC.

> +	rtc_reg = TPS65910_RTC_CTRL_STOP_RTC;
> +	ret = regmap_write(tps65910->regmap, TPS65910_RTC_CTRL, rtc_reg);
> +	if (ret < 0)
> +		return ret;
> +
> +	pmic_plat_data = dev_get_platdata(tps65910->dev);
> +	irq = pmic_plat_data->irq_base;
> +	if (irq <= 0) {
> +		dev_warn(&pdev->dev, "Wake up is not possible as irq = %d\n",
> +			irq);
> +		return ret;
> +	}
> +
> +	irq += TPS65910_IRQ_RTC_ALARM;
> +	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> +		tps65910_rtc_interrupt, IRQF_TRIGGER_LOW,
> +		dev_name(&tps_rtc->rtc->dev), &pdev->dev);

How does this work? It doesn't look like tps_rtc->rtc is assigned until
down there at the rtc_device_register() call.

> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "IRQ is not free.\n");
> +		return ret;
> +	}
> +	device_init_wakeup(&pdev->dev, 1);
> +
> +	tps_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
> +		&tps65910_rtc_ops, THIS_MODULE);
> +	if (IS_ERR(tps_rtc->rtc)) {
> +		ret = PTR_ERR(tps_rtc->rtc);
> +		dev_err(&pdev->dev, "RTC device register: err %d\n", ret);
> +		return ret;
> +	}
> +

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


  parent reply	other threads:[~2012-07-30  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26  6:35 [PATCH] rtc: tps65910: Add RTC driver for TPS65910 PMIC RTC Venu Byravarasu
2012-07-27 13:28 ` Samuel Ortiz
2012-07-30  9:16 ` Stephen Boyd [this message]
2012-07-30 10:07   ` Venu Byravarasu
2012-07-30 17:06     ` Stephen Boyd
2012-08-14 23:52 ` Andrew Morton
2012-08-16  5:48   ` Venu Byravarasu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5016510B.9010202@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=a.zummo@towertech.it \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=kyle.manna@fuel7.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=sameo@linux.intel.com \
    --cc=vbyravarasu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).