From: eddie.huang@mediatek.com (Eddie Huang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] rtc: mediatek: Add MT6397 RTC driver
Date: Mon, 30 Mar 2015 16:15:50 +0800 [thread overview]
Message-ID: <1427703350.26464.15.camel@mtksdaap41> (raw)
In-Reply-To: <CAKdAkRSRXZ=1T+2Mfvjc4DsCCt1rxqGZpEuOUkU5KfPD2__BnQ@mail.gmail.com>
Hi Dmitry,
On Fri, 2015-03-20 at 22:25 -0700, Dmitry Torokhov wrote:
> Hi Eddie,
>
>
> On Tue, Mar 17, 2015 at 10:45 PM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > +static int mtk_rtc_probe(struct platform_device *pdev)
> > +{
> > + struct resource *res;
> > + struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent);
> > + struct mt6397_rtc *rtc;
> > + int ret = 0;
> > +
> > + rtc = devm_kzalloc(&pdev->dev, sizeof(struct mt6397_rtc), GFP_KERNEL);
> > + if (!rtc)
> > + return -ENOMEM;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + rtc->addr_base = res->start;
> > + rtc->addr_range = res->end - res->start;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > + rtc->irq = irq_create_mapping(mt6397_chip->irq_domain, res->start);
> > + if (rtc->irq <= 0)
> > + goto out_rtc;
> > +
> > + rtc->regmap = mt6397_chip->regmap;
> > + rtc->dev = &pdev->dev;
> > + mutex_init(&rtc->lock);
> > +
> > + platform_set_drvdata(pdev, rtc);
> > +
> > + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
> > + mtk_rtc_irq_handler_thread,
> > + IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
> > + "mt6397-rtc", rtc);
> > + if (ret) {
> > + dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
> > + rtc->irq, ret);
> > + goto out_rtc;
> > + }
> > +
> > + rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev,
> > + &mtk_rtc_ops, THIS_MODULE);
> > + if (IS_ERR(rtc->rtc_dev)) {
> > + dev_err(&pdev->dev, "register rtc device failed\n");
> > + return PTR_ERR(rtc->rtc_dev);
> > + }
> > +
> > + device_init_wakeup(&pdev->dev, 1);
> > +
> > + return 0;
> > +
> > +out_rtc:
> > + rtc_device_unregister(rtc->rtc_dev);
>
> This is wrong. Whenever you jump to this label the RTC device has not
> been registered yet.
Oops, will fix in next round.
Eddie
next prev parent reply other threads:[~2015-03-30 8:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 5:45 [PATCH v2 0/3] Add Mediatek SoC RTC driver Eddie Huang
2015-03-18 5:45 ` [PATCH v2 1/3] mfd: provide RTC resource in MT6397 MFD Eddie Huang
2015-03-18 7:30 ` Lee Jones
2015-03-30 8:17 ` Eddie Huang
2015-03-18 5:45 ` [PATCH v2 2/3] rtc: mediatek: Add MT6397 RTC driver Eddie Huang
2015-03-21 5:25 ` Dmitry Torokhov
2015-03-30 8:15 ` Eddie Huang [this message]
2015-03-31 22:01 ` Andrew Morton
2015-03-30 7:41 ` Tomasz Figa
2015-03-31 9:44 ` Eddie Huang
2015-03-31 11:01 ` Tomasz Figa
2015-03-18 5:45 ` [PATCH v2 3/3] MAINTAINERS: add Mediatek " Eddie Huang
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=1427703350.26464.15.camel@mtksdaap41 \
--to=eddie.huang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).